feat(eww): fix overcomplicated hack for button anims fade

This commit is contained in:
matt1432 2023-08-19 20:44:37 -04:00
parent 256f0af183
commit d42926a5bc
8 changed files with 46 additions and 193 deletions

View file

@ -14,12 +14,7 @@ for element in "${array[@]}"
do do
[[ "$element" != "left-bar" ]] && [[ "$element" != "left-bar" ]] &&
[[ "$element" != "notif-panel" ]] && [[ "$element" != "notif-panel" ]] &&
[[ "$element" != "notif-panel-on" ]] &&
[[ "$element" != "heart" ]] &&
[[ "$element" != "osk" ]] &&
[[ "$element" != "tablet" ]] &&
[[ "$element" != "quick-settings-toggle" ]] && [[ "$element" != "quick-settings-toggle" ]] &&
[[ "$element" != "playerinfo" ]] && [[ "$element" != "playerinfo" ]] &&
#[[ "$element" != "" ]] &&
eww close "$element" eww close "$element"
done done

View file

@ -4,11 +4,9 @@ FILE="$HOME/.config/.heart"
toggle() { toggle() {
if grep -q 󰣐 "$FILE"; then if grep -q 󰣐 "$FILE"; then
eww close heart
eww update heart-ts=false eww update heart-ts=false
echo  > "$FILE" echo  > "$FILE"
else else
eww open heart
eww update heart-ts=true eww update heart-ts=true
echo 󰣐 >> "$FILE" echo 󰣐 >> "$FILE"
fi fi
@ -36,9 +34,7 @@ startup() {
input-emulator start mouse -n & input-emulator start mouse -n &
if grep -q 󰣐 "$FILE"; then if grep -q 󰣐 "$FILE"; then
eww close heart
sleep 0.9 && sleep 0.9 &&
eww open heart
eww update heart-ts=true eww update heart-ts=true
fi fi

View file

@ -4,30 +4,16 @@ on() {
# open notif panel # open notif panel
swaync-client -op swaync-client -op
# open closers when outside control center # open closers to close when outside control center
eww open closer-notif1 eww open closer-notif1
eww open closer-notif2 eww open closer-notif2
eww open closer-notif3 eww open closer-notif3
# reload waybar to draw over closers
#killall -r -SIGUSR2 waybar &&
# re open eww widgets over closers # FIXME: ??
eww close notif-panel; eww open notif-panel &&
eww open notif-panel-on
eww update notif-panel-state=true eww update notif-panel-state=true
eww close quick-settings-toggle; eww open quick-settings-toggle
#eww close left-bar; eww open left-bar
#if eww get osk-ts; then eww close osk; eww open osk; fi
#if eww get tablet-ts; then eww close tablet; eww open tablet; fi
#if eww get heart-ts; then eww close heart; eww open heart; fi
} }
off() { off() {
swaync-client -cp swaync-client -cp
eww close notif-panel-on
eww update notif-panel-state=false eww update notif-panel-state=false

View file

@ -39,7 +39,8 @@
color: #CBA6F7; color: #CBA6F7;
border-radius: 80px; border-radius: 80px;
border: 2px solid #1b1b2b; border: 2px solid #1b1b2b;
transition: background-color 0.5s ease-in-out; transition: background-color 0.5s ease-in-out,
border 0.5s ease-in-out;
} }
.toggle-on { .toggle-on {
@ -48,10 +49,12 @@
color: #CBA6F7; color: #CBA6F7;
border-radius: 80px; border-radius: 80px;
border: 2px solid $contrastbg; border: 2px solid $contrastbg;
transition: background-color 0.5s ease-in-out; transition: background-color 0.5s ease-in-out,
border 0.5s ease-in-out;
} }
.toggle-on:hover, .toggle-off:hover { .toggle-on:hover, .toggle-off:hover {
background-color: rgba(127, 132, 156, 0.4); background-color: rgba(127, 132, 156, 0.4);
transition: background-color 0.5s ease-in-out; transition: background-color 0.5s ease-in-out,
border 0.5s ease-in-out;
} }

View file

@ -2,13 +2,14 @@
;; On-Screen Keyboard Toggle ;; On-Screen Keyboard Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar osk-ts false) (defvar osk-ts false)
(defvar osk-run-off "false") (defvar osk-run "false")
(defwidget osk-toggle-on []
(eventbox :class "toggle-on" (defwidget osk-toggle []
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/osk-toggle.sh toggle' osk-run-off &" (eventbox :class "${osk-ts == 'true' ? 'toggle-on' : 'toggle-off'}"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/osk-toggle.sh toggle' osk-run &"
:cursor "pointer" :cursor "pointer"
:onhover "eww update osk-run-off=true" :onhover "eww update osk-run=true"
:onhoverlost "eww update osk-run-off=false" :onhoverlost "eww update osk-run=false"
(box :class "osk-toggle" (box :class "osk-toggle"
:orientation "h" :orientation "h"
@ -16,49 +17,22 @@
) )
) )
) )
(defvar osk-run-on "false")
(defwidget osk-toggle-off []
(eventbox :class "toggle-off"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/osk-toggle.sh toggle' osk-run-on &"
:cursor "pointer"
:onhover "eww update osk-run-on=true"
:onhoverlost "eww update osk-run-on=false"
(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 anim_duration
(osk-toggle-on)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tablet Mode Toggle ;; Tablet Mode Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar tablet-ts false) (defvar tablet-ts false)
(defvar tablet-run-off "false") (defvar tablet-run "false")
(defwidget tablet-toggle-on []
(eventbox :class "toggle-on" (defvar turn-tablet-off "$EWW_PATH/run.sh '$HYPR_PATH/laptop-mode.sh' tablet-run &")
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/laptop-mode.sh' tablet-run-off &" (defvar turn-tablet-on "$EWW_PATH/run.sh '$HYPR_PATH/tablet-mode.sh' tablet-run &")
(defwidget tablet-toggle []
(eventbox :class "${tablet-ts == 'true' ? 'toggle-on' : 'toggle-off'}"
:onclick "${tablet-ts == 'true' ? turn-tablet-off : turn-tablet-on}"
:cursor "pointer" :cursor "pointer"
:onhover "eww update tablet-run-off=true" :onhover "eww update tablet-run=true"
:onhoverlost "eww update tablet-run-off=false" :onhoverlost "eww update tablet-run=false"
(box :class "tablet-toggle" (box :class "tablet-toggle"
:orientation "h" :orientation "h"
@ -66,49 +40,19 @@
) )
) )
) )
(defvar tablet-run-on "false")
(defwidget tablet-toggle-off []
(eventbox :class "toggle-off"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/tablet-mode.sh' tablet-run-on &"
:cursor "pointer"
:onhover "eww update tablet-run-on=true"
:onhoverlost "eww update tablet-run-on=false"
(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 anim_duration
(tablet-toggle-on)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Heart Toggle ;; Heart Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar heart-ts "false") (defvar heart-ts "false")
(defvar heart-run-off "false") (defvar heart-run "false")
(defwidget heart-toggle-on []
(eventbox :class "toggle-on" (defwidget heart-toggle []
:onclick "$EWW_PATH/run.sh '$EWW_PATH/heart.sh toggle' heart-run-off &" (eventbox :class "${heart-ts == 'true' ? 'toggle-on' : 'toggle-off'}"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/heart.sh toggle' heart-run &"
:cursor "pointer" :cursor "pointer"
:onhover "eww update heart-run-off=true" :onhover "eww update heart-run=true"
:onhoverlost "eww update heart-run-off=false" :onhoverlost "eww update heart-run=false"
(box :class "heart-toggle" (box :class "heart-toggle"
:orientation "h" :orientation "h"
@ -116,37 +60,6 @@
) )
) )
) )
(defvar heart-run-on "false")
(defwidget heart-toggle-off []
(eventbox :class "toggle-off"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/heart.sh toggle' heart-run-on &"
:cursor "pointer"
:onhover "eww update heart-run-on=true"
:onhoverlost "eww update heart-run-on=false"
(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 anim_duration
(heart-toggle-on)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Left Bar ;; Left Bar
@ -156,9 +69,9 @@
:space-evenly true :space-evenly true
:spacing 12 :spacing 12
:orientation "h" :orientation "h"
(osk-toggle-off) (osk-toggle)
(tablet-toggle-off) (tablet-toggle)
(heart-toggle-off) (heart-toggle)
) )
) )
(defwindow left-bar (defwindow left-bar
@ -208,13 +121,16 @@
;; Notification Panel Toggle ;; Notification Panel Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar notif-panel-state false) (defvar notif-panel-state false)
(defvar notif-run-off "false") (defvar notif-run "false")
(defwidget notif-panel-on [] (defvar turn-notif-on "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh on' notif-run &")
(eventbox :class "toggle-on" (defvar turn-notif-off "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh off' notif-run &")
:onclick "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh off' notif-run-off &"
(defwidget notif-panel []
(eventbox :class "${notif-panel-state == 'true' ? 'toggle-on' : 'toggle-off'}"
:onclick "${notif-panel-state == 'true' ? turn-notif-off : turn-notif-on}"
:cursor "pointer" :cursor "pointer"
:onhover "eww update notif-run-off=true" :onhover "eww update notif-run=true"
:onhoverlost "eww update notif-run-off=false" :onhoverlost "eww update notif-run=false"
(box :class "notif-panel" (box :class "notif-panel"
:orientation "h" :orientation "h"
@ -222,21 +138,6 @@
) )
) )
) )
(defvar notif-run-on "false")
(defwidget notif-panel-off []
(eventbox :class "toggle-off"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh on' notif-run-on &"
:cursor "pointer"
:onhover "eww update notif-run-on=true"
:onhoverlost "eww update notif-run-on=false"
(box :class "notif-panel"
:orientation "h"
(label :text " ${notif_icon} ")
)
)
)
(defwindow notif-panel (defwindow notif-panel
:monitor 0 :monitor 0
:stacking "overlay" :stacking "overlay"
@ -247,22 +148,5 @@
:height "0px" :height "0px"
:anchor "top right" :anchor "top right"
) )
(notif-panel-off) (notif-panel)
)
(defwindow notif-panel-on
:monitor 0
:stacking "overlay"
:exclusive "ignore"
:geometry (geometry :x "60px"
:y "10px"
:width "0px"
:height "0px"
:anchor "top right"
)
(revealer
:transition "crossfade"
:reveal notif-panel-state
:duration anim_duration
(notif-panel-on)
)
) )

View file

@ -7,5 +7,4 @@ 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

@ -3,14 +3,10 @@
state () { state () {
if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then
#echo "Running" #echo "Running"
eww open osk
eww update osk-ts=true eww update osk-ts=true
else else
#echo "Stopped" #echo "Stopped"
if [[ $(eww windows | grep '*osk') != "" ]]; then eww update osk-ts=false
eww close osk
eww update osk-ts=false
fi
fi fi
} }
@ -18,14 +14,10 @@ toggle () {
if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then
echo "Running" echo "Running"
busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
if [[ $(eww windows | grep '*osk') != "" ]]; then eww update osk-ts=false
eww close osk
eww update osk-ts=false
fi
else else
echo "Stopped" echo "Stopped"
busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
eww open osk
eww update osk-ts=true eww update osk-ts=true
fi fi
} }

View file

@ -1,6 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "$XDG_DATA_DIRS" >> ~/log.log
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
brightnessctl -d tpacpi::kbd_backlight s 0 brightnessctl -d tpacpi::kbd_backlight s 0
@ -13,5 +12,4 @@ 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