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
[[ "$element" != "left-bar" ]] &&
[[ "$element" != "notif-panel" ]] &&
[[ "$element" != "notif-panel-on" ]] &&
[[ "$element" != "heart" ]] &&
[[ "$element" != "osk" ]] &&
[[ "$element" != "tablet" ]] &&
[[ "$element" != "quick-settings-toggle" ]] &&
[[ "$element" != "playerinfo" ]] &&
#[[ "$element" != "" ]] &&
eww close "$element"
done

View file

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

View file

@ -4,30 +4,16 @@ on() {
# open notif panel
swaync-client -op
# open closers when outside control center
# open closers to close when outside control center
eww open closer-notif1
eww open closer-notif2
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 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() {
swaync-client -cp
eww close notif-panel-on
eww update notif-panel-state=false

View file

@ -39,7 +39,8 @@
color: #CBA6F7;
border-radius: 80px;
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 {
@ -48,10 +49,12 @@
color: #CBA6F7;
border-radius: 80px;
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 {
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar osk-ts false)
(defvar osk-run-off "false")
(defwidget osk-toggle-on []
(eventbox :class "toggle-on"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/osk-toggle.sh toggle' osk-run-off &"
(defvar osk-run "false")
(defwidget osk-toggle []
(eventbox :class "${osk-ts == 'true' ? 'toggle-on' : 'toggle-off'}"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/osk-toggle.sh toggle' osk-run &"
:cursor "pointer"
:onhover "eww update osk-run-off=true"
:onhoverlost "eww update osk-run-off=false"
:onhover "eww update osk-run=true"
:onhoverlost "eww update osk-run=false"
(box :class "osk-toggle"
: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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar tablet-ts false)
(defvar tablet-run-off "false")
(defwidget tablet-toggle-on []
(eventbox :class "toggle-on"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/laptop-mode.sh' tablet-run-off &"
(defvar tablet-run "false")
(defvar turn-tablet-off "$EWW_PATH/run.sh '$HYPR_PATH/laptop-mode.sh' tablet-run &")
(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"
:onhover "eww update tablet-run-off=true"
:onhoverlost "eww update tablet-run-off=false"
:onhover "eww update tablet-run=true"
:onhoverlost "eww update tablet-run=false"
(box :class "tablet-toggle"
: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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar heart-ts "false")
(defvar heart-run-off "false")
(defwidget heart-toggle-on []
(eventbox :class "toggle-on"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/heart.sh toggle' heart-run-off &"
(defvar heart-run "false")
(defwidget heart-toggle []
(eventbox :class "${heart-ts == 'true' ? 'toggle-on' : 'toggle-off'}"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/heart.sh toggle' heart-run &"
:cursor "pointer"
:onhover "eww update heart-run-off=true"
:onhoverlost "eww update heart-run-off=false"
:onhover "eww update heart-run=true"
:onhoverlost "eww update heart-run=false"
(box :class "heart-toggle"
: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
@ -156,9 +69,9 @@
:space-evenly true
:spacing 12
:orientation "h"
(osk-toggle-off)
(tablet-toggle-off)
(heart-toggle-off)
(osk-toggle)
(tablet-toggle)
(heart-toggle)
)
)
(defwindow left-bar
@ -208,13 +121,16 @@
;; Notification Panel Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar notif-panel-state false)
(defvar notif-run-off "false")
(defwidget notif-panel-on []
(eventbox :class "toggle-on"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh off' notif-run-off &"
(defvar notif-run "false")
(defvar turn-notif-on "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh on' notif-run &")
(defvar turn-notif-off "$EWW_PATH/run.sh '$EWW_PATH/notif-toggle.sh off' notif-run &")
(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"
:onhover "eww update notif-run-off=true"
:onhoverlost "eww update notif-run-off=false"
:onhover "eww update notif-run=true"
:onhoverlost "eww update notif-run=false"
(box :class "notif-panel"
: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
:monitor 0
:stacking "overlay"
@ -247,22 +148,5 @@
:height "0px"
:anchor "top right"
)
(notif-panel-off)
)
(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)
)
(notif-panel)
)

View file

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

View file

@ -3,29 +3,21 @@
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"
if [[ $(eww windows | grep '*osk') != "" ]]; then
eww close osk
eww update osk-ts=false
fi
fi
}
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
if [[ $(eww windows | grep '*osk') != "" ]]; then
eww close osk
eww update osk-ts=false
fi
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
}

View file

@ -1,6 +1,5 @@
#!/usr/bin/env bash
echo "$XDG_DATA_DIRS" >> ~/log.log
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
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/video-bus" &
eww open tablet
eww update tablet-ts=true