diff --git a/config/eww/scripts/heart.sh b/config/eww/scripts/heart.sh index eba4c713..c39f790f 100755 --- a/config/eww/scripts/heart.sh +++ b/config/eww/scripts/heart.sh @@ -6,9 +6,11 @@ if [[ ! -f "$FILE" ]]; then fi if grep -q 󰣐 "$FILE"; then + eww close heart eww update heart-ts=false echo  > "$FILE" else + eww open heart eww update heart-ts=true echo 󰣐 >> "$FILE" fi diff --git a/config/eww/traybuttons/traybuttons.scss b/config/eww/traybuttons/traybuttons.scss index ed33cb8d..d24b11c3 100644 --- a/config/eww/traybuttons/traybuttons.scss +++ b/config/eww/traybuttons/traybuttons.scss @@ -35,7 +35,7 @@ .toggle-off { background-color: $bg; - transition: border-color 0.5s ease-in-out; + //transition: border-color 0.5s ease-in-out; color: #CBA6F7; border-radius: 80px; border: 2px solid #1b1b2b; @@ -48,7 +48,7 @@ .toggle-on { background-color: $bg; - transition: border-color 0.5s ease-in-out; + //transition: border-color 0.5s ease-in-out; color: #CBA6F7; border-radius: 80px; border: 2px solid $contrastbg; diff --git a/config/eww/traybuttons/traybuttons.yuck b/config/eww/traybuttons/traybuttons.yuck index bad65853..b6b784e6 100644 --- a/config/eww/traybuttons/traybuttons.yuck +++ b/config/eww/traybuttons/traybuttons.yuck @@ -2,10 +2,10 @@ ;; On-Screen Keyboard Toggle ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar osk-ts false) -(defwidget osk-toggle [] - (eventbox :class {osk-ts ? "toggle-on" : "toggle-off"} - :onclick "$HYPR_PATH/osk-toggle.sh toggle &" - :cursor "pointer" +(defwidget osk-toggle-on [] + (eventbox :class "toggle-on" + :onclick "$HYPR_PATH/osk-toggle.sh toggle &" + :cursor "pointer" (box :class "osk-toggle" :orientation "h" @@ -13,6 +13,34 @@ ) ) ) +(defwidget osk-toggle-off [] + (eventbox :class "toggle-off" + :onclick "$HYPR_PATH/osk-toggle.sh toggle &" + :cursor "pointer" + + (box :class "osk-toggle" + :orientation "h" + (label :text " 󰌌 ") + ) + ) +) +(defwindow osk + :monitor 0 + :stacking "overlay" + :exclusive "ignore" + :geometry (geometry :x "5px" + :y "10px" + :width "0px" + :height "0px" + :anchor "top left" + ) + (revealer + :transition "crossfade" + :reveal osk-ts + :duration "550ms" + (osk-toggle-on) + ) +) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Tablet Mode Toggle @@ -34,8 +62,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Heart Toggle ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defwidget heart-toggle [] - (eventbox :class {heart_icon == "󰣐" ? "toggle-on" : "toggle-off"} +(defvar heart-ts "default") +(defwidget heart-toggle-on [] + (eventbox :class "toggle-on" :onclick "$EWW_PATH/heart.sh" :cursor "pointer" @@ -45,6 +74,34 @@ ) ) ) +(defwidget heart-toggle-off [] + (eventbox :class "toggle-off" + :onclick "$EWW_PATH/heart.sh" + :cursor "pointer" + + (box :class "heart-toggle" + :orientation "h" + (label :text " ${heart_icon} ") + ) + ) +) +(defwindow heart + :monitor 0 + :stacking "overlay" + :exclusive "ignore" + :geometry (geometry :x "140px" + :y "10px" + :width "0px" + :height "0px" + :anchor "top left" + ) + (revealer + :transition "crossfade" + :reveal heart-ts + :duration "550ms" + (heart-toggle-on) + ) +) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Left Bar @@ -54,9 +111,9 @@ :space-evenly true :spacing 12 :orientation "h" - (osk-toggle) + (osk-toggle-off) (tablet-toggle) - (heart-toggle) + (heart-toggle-off) ) ) (defwindow left-bar diff --git a/config/hypr/main.conf b/config/hypr/main.conf index 57cad8f3..de8ad337 100644 --- a/config/hypr/main.conf +++ b/config/hypr/main.conf @@ -30,6 +30,8 @@ exec-once = $HYPR_PATH/osk-toggle.sh getState # sometimes waybar starts after and stops me from pressing eww buttons exec-once = bash -c "sleep 0.5; eww reload" +exec-once = bash -c "grep -q 󰣐 $HOME/.config/.heart && eww open heart && sleep 0.5 && eww update showh=true" + exec-once = gnome-keyring-daemon --start --components=secrets exec-once = squeekboard diff --git a/config/hypr/scripts/osk-toggle.sh b/config/hypr/scripts/osk-toggle.sh index 7a5b7326..500c2b92 100755 --- a/config/hypr/scripts/osk-toggle.sh +++ b/config/hypr/scripts/osk-toggle.sh @@ -3,9 +3,11 @@ state () { if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then echo "Running" + eww open osk eww update osk-ts=true else echo "Stopped" + eww close osk eww update osk-ts=false fi } @@ -14,10 +16,12 @@ toggle () { if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then echo "Running" busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false + eww close osk eww update osk-ts=false else echo "Stopped" busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true + eww open osk eww update osk-ts=true fi }