From 5b3916e71271ddd2c164125aef016ca9d55a56f1 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Thu, 27 Jul 2023 22:00:08 -0400 Subject: [PATCH] fix: fix tablet-toggle animation --- config/eww/traybuttons/traybuttons.yuck | 37 +++++++++++++++++++++---- config/hypr/main.conf | 2 +- config/hypr/scripts/laptop-mode.sh | 1 + config/hypr/scripts/tablet-mode.sh | 1 + 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/config/eww/traybuttons/traybuttons.yuck b/config/eww/traybuttons/traybuttons.yuck index b6b784e6..55c1518d 100644 --- a/config/eww/traybuttons/traybuttons.yuck +++ b/config/eww/traybuttons/traybuttons.yuck @@ -46,10 +46,9 @@ ;; Tablet Mode Toggle ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar tablet-ts false) -(defwidget tablet-toggle [] - (eventbox :class {tablet-ts ? "toggle-on" : "toggle-off"} - :onclick {tablet-ts ? "$HYPR_PATH/laptop-mode.sh &" : - "$HYPR_PATH/tablet-mode.sh &"} +(defwidget tablet-toggle-on [] + (eventbox :class "toggle-on" + :onclick "$HYPR_PATH/laptop-mode.sh &" :cursor "pointer" (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 @@ -112,7 +139,7 @@ :spacing 12 :orientation "h" (osk-toggle-off) - (tablet-toggle) + (tablet-toggle-off) (heart-toggle-off) ) ) diff --git a/config/hypr/main.conf b/config/hypr/main.conf index de8ad337..796fcbcb 100644 --- a/config/hypr/main.conf +++ b/config/hypr/main.conf @@ -30,7 +30,7 @@ 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 = 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 = squeekboard diff --git a/config/hypr/scripts/laptop-mode.sh b/config/hypr/scripts/laptop-mode.sh index 42e89062..e6ffc1f5 100755 --- a/config/hypr/scripts/laptop-mode.sh +++ b/config/hypr/scripts/laptop-mode.sh @@ -7,4 +7,5 @@ brightnessctl -d tpacpi::kbd_backlight s 2 killall -r autorotate.sh killall -r evtest +eww close tablet eww update tablet-ts=false diff --git a/config/hypr/scripts/tablet-mode.sh b/config/hypr/scripts/tablet-mode.sh index bd5ab918..19dac1b6 100755 --- a/config/hypr/scripts/tablet-mode.sh +++ b/config/hypr/scripts/tablet-mode.sh @@ -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/video-bus" & +eww open tablet eww update tablet-ts=true