feat(eww): fix touch_up bug

This commit is contained in:
matt1432 2023-08-13 15:12:49 -04:00
parent 416a4e1635
commit 568876794b
3 changed files with 34 additions and 4 deletions

View file

@ -9,12 +9,13 @@ function run() {
while IFS='$\n' read -r line; do
if [[ $(echo "$line" | grep TOUCH_UP) != "" ]]; then
run
if [[ $(echo "$line" | grep '1 (1)') != "" ]]; then
eww update cancel_touch=false
fi
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

23
config/eww/scripts/run.sh Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
FILE="$HOME/.config/.on-release"
SCRIPT="$1"
VAR="$2"
function run() {
if [[ $(eww get "$VAR") == "true" ]]; then
if [[ $(eww get cancel_touch) == "false" ]]; then
bash -c "$SCRIPT"
fi
else
eww open on-release-fix
sleep 0.1
input-emulator mouse button left
fi
echo "cant_run" > "$FILE"
}
while IFS='$\n' read -r line; do
[[ $(grep "can_run" "$FILE") != "" ]] && run
[[ $(grep "cant_run" "$FILE") != "" ]] && exit 0
done < <(stdbuf -oL tail -f "$FILE")

View file

@ -46,10 +46,13 @@
;; Tablet Mode Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar tablet-ts false)
(defvar tablet-run-off "false")
(defwidget tablet-toggle-on []
(eventbox :class "toggle-on"
:onclick "$HYPR_PATH/laptop-mode.sh &"
:onclick "$EWW_PATH/run.sh '$HYPR_PATH/laptop-mode.sh' tablet-run-off &"
:cursor "pointer"
:onhover "eww update tablet-run-off=true"
:onhoverlost "eww update tablet-run-off=false"
(box :class "tablet-toggle"
:orientation "h"
@ -57,10 +60,13 @@
)
)
)
(defvar tablet-run-on "false")
(defwidget tablet-toggle-off []
(eventbox :class "toggle-off"
:onclick "$HYPR_PATH/tablet-mode.sh &"
: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"