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 while IFS='$\n' read -r line; do
if [[ $(echo "$line" | grep TOUCH_UP) != "" ]]; then if [[ $(echo "$line" | grep TOUCH_UP) != "" ]]; then
run run
if [[ $(echo "$line" | grep '1 (1)') != "" ]]; then
eww update cancel_touch=false
fi
elif [[ $(echo "$line" | grep release) != "" ]]; then elif [[ $(echo "$line" | grep release) != "" ]]; then
run run
elif [[ $(echo "$line" | grep 'TOUCH_DOWN.*1 (1)') != "" ]]; then elif [[ $(echo "$line" | grep 'TOUCH_DOWN.*1 (1)') != "" ]]; then
eww update cancel_touch=true eww update cancel_touch=true
elif [[ $(echo "$line" | grep 'TOUCH_UP.*1 (1)') != "" ]]; then
eww update cancel_touch=false
else else
echo "other" > "$FILE" echo "other" > "$FILE"
fi 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 ;; Tablet Mode Toggle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar tablet-ts false) (defvar tablet-ts false)
(defvar tablet-run-off "false")
(defwidget tablet-toggle-on [] (defwidget tablet-toggle-on []
(eventbox :class "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" :cursor "pointer"
:onhover "eww update tablet-run-off=true"
:onhoverlost "eww update tablet-run-off=false"
(box :class "tablet-toggle" (box :class "tablet-toggle"
:orientation "h" :orientation "h"
@ -57,10 +60,13 @@
) )
) )
) )
(defvar tablet-run-on "false")
(defwidget tablet-toggle-off [] (defwidget tablet-toggle-off []
(eventbox :class "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" :cursor "pointer"
:onhover "eww update tablet-run-on=true"
:onhoverlost "eww update tablet-run-on=false"
(box :class "tablet-toggle" (box :class "tablet-toggle"
:orientation "h" :orientation "h"