2 changed files with 29 additions and 16 deletions
@ -1,27 +1,32 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## |
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## |
||||||
# For disabling touchpad. |
# For disabling touchpad. |
||||||
# Edit the Touchpad_Device according to your system |
# Edit the Touchpad_Device on ~/.config/hypr/UserConfigs/Laptops.conf according to your system |
||||||
# use hyprctl devices to get your system touchpad device name |
# use hyprctl devices to get your system touchpad device name |
||||||
|
# source https://github.com/hyprwm/Hyprland/discussions/4283?sort=new#discussioncomment-8648109 |
||||||
|
|
||||||
|
|
||||||
Touchpad_Device="asue1209:00-04f3:319f-touchpad" |
|
||||||
notif="$HOME/.config/swaync/images/bell.png" |
notif="$HOME/.config/swaync/images/bell.png" |
||||||
|
|
||||||
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} |
export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" |
||||||
STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" |
|
||||||
|
|
||||||
toggle_touchpad() { |
enable_touchpad() { |
||||||
if [ ! -f "$STATUS_FILE" ] || [ "$(cat "$STATUS_FILE")" = "false" ]; then |
printf "true" >"$STATUS_FILE" |
||||||
echo "true" > "$STATUS_FILE" |
notify-send -u low -i $notif "Enabling touchpad" |
||||||
action="enabled" |
hyprctl keyword '$TOUCHPAD_ENABLED' "true" -r |
||||||
else |
} |
||||||
echo "false" > "$STATUS_FILE" |
|
||||||
action="disabled" |
|
||||||
fi |
|
||||||
|
|
||||||
notify-send -u low -i "$notif" "Touchpad $action" |
disable_touchpad() { |
||||||
hyprctl keyword "device[$Touchpad_Device]:enabled" "$(cat "$STATUS_FILE")" |
printf "false" >"$STATUS_FILE" |
||||||
|
notify-send -u low -i $notif "Disabling touchpad" |
||||||
|
hyprctl keyword '$TOUCHPAD_ENABLED' "false" -r |
||||||
} |
} |
||||||
|
|
||||||
toggle_touchpad |
if ! [ -f "$STATUS_FILE" ]; then |
||||||
|
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