feat(eww): add notif-panel anim and hack around swaync bugs

This commit is contained in:
matt1432 2023-08-03 23:07:22 -04:00
parent 0a9473c071
commit e4ac599ce5
8 changed files with 131 additions and 31 deletions

View file

@ -1,6 +1,8 @@
what is currently not working:
- plymouth theme has no login prompt
- sddm theme flashes white
- fixme: swaync acts up with eww
- autosign in to keyring
what i want to do:
- learn flakes

View file

@ -1,9 +1,39 @@
(defwidget closer []
(eventbox :onclick "$EWW_PATH/close-opened.sh && eww close closer"))
(eventbox :onclick "$EWW_PATH/close-opened.sh && eww close closer")
)
(defwindow closer :monitor 0
:geometry (geometry :width "100%"
:height "100%")
:stacking "overlay"
:focusable false
(closer :window "")
)
(defwindow closer
:monitor 0
:geometry (geometry :width "100%" :height "100%")
:stacking "overlay"
:focusable false
(closer :window ""))
(defwidget closer-notif []
(eventbox :onclick "$EWW_PATH/notif-toggle.sh off")
)
(defwindow closer-notif1 :monitor 0
:geometry (geometry :width "1412px"
:height "1200px")
:stacking "overlay"
:focusable false
:exclusive "ignore"
(closer-notif)
)
(defwindow closer-notif2 :monitor 0
:geometry (geometry :width "100%"
:height "200px"
:y "1063px")
:stacking "overlay"
:focusable false
:exclusive "ignore"
(closer-notif)
)
(defwindow closer-notif3 :monitor 0
:geometry (geometry :width "100%"
:height "63px")
:stacking "overlay"
:focusable false
:exclusive "ignore"
(closer-notif)
)

View file

@ -7,13 +7,18 @@ readarray -t array <<< "$(eww windows | grep '^\*')"
for ((i=0; i<${#array[@]}; i++))
do
array[i]=${array[i]#'*'}
array[i]=${array[i]%-reveal}
done
# Close every window except permanent ones
for element in "${array[@]}"
do
if [[ "$element" != "left-bar" && "$element" != "right-bar" ]]; then
"$EWW_PATH"/close.sh "$element"
fi
[[ "$element" != "left-bar" ]] &&
[[ "$element" != "notif-panel" ]] &&
[[ "$element" != "notif-panel-on" ]] &&
[[ "$element" != "heart" ]] &&
[[ "$element" != "osk" ]] &&
[[ "$element" != "tablet" ]] &&
[[ "$element" != "quick-settings-toggle" ]] &&
#[[ "$element" != "" ]] &&
eww close "$element"
done

View file

@ -1,8 +0,0 @@
#!/usr/bin/env bash
WINDOW="$1"
(
eww update "$WINDOW"-visible=false
#sleep .55
eww close "$WINDOW"-reveal
) &

View file

@ -0,0 +1,40 @@
#!/usr/bin/env bash
on() {
# open notif panel
swaync-client -op
# open closers 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
eww close closer-notif1
eww close closer-notif2
eww close closer-notif3
}
[[ "$1" == "on" ]] && on
[[ "$1" == "off" ]] && off

View file

@ -4,7 +4,6 @@ state () {
if [[ $(hyprctl layers | grep swaync-control-center) == "" ]]; then
if [[ $(eww get notif-panel-state) == "true" ]]; then
eww update notif-panel-state=false
eww reload
fi
fi
}

View file

@ -188,10 +188,9 @@
;; Notification Panel Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar notif-panel-state false)
(defwidget notif-panel []
(eventbox :class {notif-panel-state ? "toggle-on" : "toggle-off"}
:onclick {notif-panel-state ? "swaync-client -cp; eww update notif-panel-state=false" :
"swaync-client -op; eww update notif-panel-state=true"}
(defwidget notif-panel-on []
(eventbox :class "toggle-on"
:onclick "$EWW_PATH/notif-toggle.sh off"
:cursor "pointer"
(box :class "notif-panel"
@ -200,6 +199,18 @@
)
)
)
(defwidget notif-panel-off []
(eventbox :class "toggle-off"
:onclick "$EWW_PATH/notif-toggle.sh on"
:cursor "pointer"
(box :class "notif-panel"
:orientation "h"
(label :text " ${notif_icon} ")
)
)
)
(defwindow notif-panel
:monitor 0
:stacking "overlay"
@ -210,5 +221,22 @@
:height "0px"
:anchor "top right"
)
(notif-panel)
(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 "550ms"
(notif-panel-on)
)
)

View file

@ -7,8 +7,10 @@ state () {
eww update osk-ts=true
else
echo "Stopped"
eww close osk
eww update osk-ts=false
if [[ $(eww windows | grep '*osk') != "" ]]; then
eww close osk
eww update osk-ts=false
fi
fi
}
@ -16,13 +18,15 @@ 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
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
eww open osk
eww update osk-ts=true
fi
}