fix: fix animation for heart and osk buttons

This commit is contained in:
matt1432 2023-07-27 21:46:32 -04:00
parent 49f2c8dbca
commit 5862efb395
5 changed files with 75 additions and 10 deletions

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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
}