fix: fix tablet-toggle animation

This commit is contained in:
matt1432 2023-07-27 22:00:08 -04:00
parent 5862efb395
commit 5b3916e712
4 changed files with 35 additions and 6 deletions

View file

@ -46,10 +46,9 @@
;; Tablet Mode Toggle ;; Tablet Mode Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar tablet-ts false) (defvar tablet-ts false)
(defwidget tablet-toggle [] (defwidget tablet-toggle-on []
(eventbox :class {tablet-ts ? "toggle-on" : "toggle-off"} (eventbox :class "toggle-on"
:onclick {tablet-ts ? "$HYPR_PATH/laptop-mode.sh &" : :onclick "$HYPR_PATH/laptop-mode.sh &"
"$HYPR_PATH/tablet-mode.sh &"}
:cursor "pointer" :cursor "pointer"
(box :class "tablet-toggle" (box :class "tablet-toggle"
@ -58,6 +57,34 @@
) )
) )
) )
(defwidget tablet-toggle-off []
(eventbox :class "toggle-off"
:onclick "$HYPR_PATH/tablet-mode.sh &"
:cursor "pointer"
(box :class "tablet-toggle"
:orientation "h"
(label :text " 󰦧 ")
)
)
)
(defwindow tablet
:monitor 0
:stacking "overlay"
:exclusive "ignore"
:geometry (geometry :x "72px"
:y "10px"
:width "0px"
:height "0px"
:anchor "top left"
)
(revealer
:transition "crossfade"
:reveal tablet-ts
:duration "550ms"
(tablet-toggle-on)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Heart Toggle ;; Heart Toggle
@ -112,7 +139,7 @@
:spacing 12 :spacing 12
:orientation "h" :orientation "h"
(osk-toggle-off) (osk-toggle-off)
(tablet-toggle) (tablet-toggle-off)
(heart-toggle-off) (heart-toggle-off)
) )
) )

View file

@ -30,7 +30,7 @@ exec-once = $HYPR_PATH/osk-toggle.sh getState
# sometimes waybar starts after and stops me from pressing eww buttons # sometimes waybar starts after and stops me from pressing eww buttons
exec-once = bash -c "sleep 0.5; eww reload" 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 = bash -c "grep -q 󰣐 $HOME/.config/.heart && eww open heart && sleep 0.5 && eww update heart-ts=true"
exec-once = gnome-keyring-daemon --start --components=secrets exec-once = gnome-keyring-daemon --start --components=secrets
exec-once = squeekboard exec-once = squeekboard

View file

@ -7,4 +7,5 @@ brightnessctl -d tpacpi::kbd_backlight s 2
killall -r autorotate.sh killall -r autorotate.sh
killall -r evtest killall -r evtest
eww close tablet
eww update tablet-ts=false eww update tablet-ts=false

View file

@ -13,4 +13,5 @@ evtest --grab "/dev/input/by-path/platform-AMDI0010:02-event-mouse" &
evtest --grab "/dev/input/by-path/platform-thinkpad_acpi-event" & evtest --grab "/dev/input/by-path/platform-thinkpad_acpi-event" &
evtest --grab "/dev/video-bus" & evtest --grab "/dev/video-bus" &
eww open tablet
eww update tablet-ts=true eww update tablet-ts=true