feat(eww): make on-release work. proof of concept with heart widget

This commit is contained in:
matt1432 2023-08-13 13:39:44 -04:00
parent 001588bad1
commit 416a4e1635
5 changed files with 38 additions and 6 deletions

View file

@ -37,3 +37,15 @@
:exclusive "ignore"
(closer-notif)
)
(defwidget on-release-fix []
(eventbox :onclick "eww close on-release-fix")
)
(defwindow on-release-fix :monitor 0
:geometry (geometry :width "100%"
:height "100%"
)
:stacking "overlay"
:exclusive "ignore"
(on-release-fix)
)

View file

@ -31,6 +31,8 @@ startup() {
fi
"$HYPR_PATH"/osk-toggle.sh getState &
"$EWW_PATH"/on-release.sh &
input-emulator start mouse -n &
if grep -q 󰣐 "$FILE"; then
eww close heart

View file

@ -1,10 +1,21 @@
#!/usr/bin/env bash
FILE="$HOME/.config/.on-release"
function run() {
echo "touch up"
exit 0
echo "can_run" > "$FILE"
}
while IFS='$\n' read -r line; do
[[ $(echo "$line" | grep TOUCH_UP) != "" ]] && run
done < <(stdbuf -oL journalctl --user -feu libinput-events)
if [[ $(echo "$line" | grep TOUCH_UP) != "" ]]; then
run
elif [[ $(echo "$line" | grep release) != "" ]]; then
run
elif [[ $(echo "$line" | grep 'TOUCH_DOWN.*1 (1)') != "" ]]; then
eww update cancel_touch=true
elif [[ $(echo "$line" | grep 'TOUCH_UP.*1 (1)') != "" ]]; then
eww update cancel_touch=false
else
echo "other" > "$FILE"
fi
done < <(stdbuf -oL libinput debug-events)

View file

@ -90,10 +90,13 @@
;; Heart Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar heart-ts "default")
(defvar heart-run-off "false")
(defwidget heart-toggle-on []
(eventbox :class "toggle-on"
:onclick "$EWW_PATH/heart.sh toggle"
:onclick "$EWW_PATH/run.sh '$EWW_PATH/heart.sh toggle' heart-run-off &"
:cursor "pointer"
:onhover "eww update heart-run-off=true"
:onhoverlost "eww update heart-run-off=false"
(box :class "heart-toggle"
:orientation "h"
@ -101,10 +104,13 @@
)
)
)
(defvar heart-run-on "false")
(defwidget heart-toggle-off []
(eventbox :class "toggle-off"
:onclick "$EWW_PATH/heart.sh toggle"
: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"

View file

@ -1,5 +1,6 @@
; this var starts all scripts needed when eww boots
(deflisten heart_icon "$EWW_PATH/heart.sh startup")
(defvar cancel_touch "false")
(deflisten notif_icon "$EWW_PATH/notif.sh icon")
(deflisten mic_icon "$EWW_PATH/mic.sh icon")