6 changed files with 26 additions and 39 deletions
@ -1,38 +1,22 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
|
|
||||||
|
HYPRLAND_DEVICE="asue1209:00-04f3:319f-touchpad" |
||||||
notif="$HOME/.config/swaync/images/bell.png" |
notif="$HOME/.config/swaync/images/bell.png" |
||||||
|
|
||||||
# NOTE: find the right device using hyprctl devices |
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} |
||||||
HYPRLAND_DEVICE="asue1209:00-04f3:319f-touchpad" |
STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" |
||||||
|
|
||||||
if [ -z "$XDG_RUNTIME_DIR" ]; then |
toggle_touchpad() { |
||||||
export XDG_RUNTIME_DIR=/run/user/$(id -u) |
if [ ! -f "$STATUS_FILE" ] || [ "$(cat "$STATUS_FILE")" = "false" ]; then |
||||||
fi |
echo "true" > "$STATUS_FILE" |
||||||
|
action="enabled" |
||||||
export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" |
else |
||||||
|
echo "false" > "$STATUS_FILE" |
||||||
enable_touchpad() { |
action="disabled" |
||||||
printf "true" > "$STATUS_FILE" |
fi |
||||||
|
|
||||||
notify-send -u low -i "$notif" "Enabling Touchpad" |
|
||||||
|
|
||||||
hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" true |
|
||||||
} |
|
||||||
|
|
||||||
disable_touchpad() { |
|
||||||
printf "false" > "$STATUS_FILE" |
|
||||||
|
|
||||||
notify-send -u low -i "$notif" "Disabling Touchpad" |
|
||||||
|
|
||||||
hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" false |
notify-send -u low -i "$notif" "Touchpad $action" |
||||||
|
hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" "$(cat "$STATUS_FILE")" |
||||||
} |
} |
||||||
|
|
||||||
if ! [ -f "$STATUS_FILE" ]; then |
toggle_touchpad |
||||||
enable_touchpad |
|
||||||
else |
|
||||||
if [ $(cat "$STATUS_FILE") = "true" ]; then |
|
||||||
disable_touchpad |
|
||||||
elif [ $(cat "$STATUS_FILE") = "false" ]; then |
|
||||||
enable_touchpad |
|
||||||
fi |
|
||||||
fi |
|
||||||
|
|||||||
Loading…
Reference in new issue