aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/toggle-touchpad
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/hyprland/.local/bin/toggle-touchpad')
-rwxr-xr-xdotfiles/hyprland/.local/bin/toggle-touchpad25
1 files changed, 25 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/toggle-touchpad b/dotfiles/hyprland/.local/bin/toggle-touchpad
new file mode 100755
index 0000000..cab605b
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/toggle-touchpad
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Toggle the laptop touchpad on/off
+
+TOUCHPAD="pixa3854:00-093a:0274-touchpad"
+STATE_FILE="${XDG_RUNTIME_DIR:-/tmp}/touchpad-state"
+
+# Default to enabled if no state file
+if [ ! -f "$STATE_FILE" ]; then
+ echo "enabled" > "$STATE_FILE"
+fi
+
+state=$(cat "$STATE_FILE")
+
+if [ "$state" = "enabled" ]; then
+ hyprctl keyword "device[$TOUCHPAD]:enabled" false >/dev/null
+ echo "disabled" > "$STATE_FILE"
+ notify info "Touchpad" "Disabled"
+else
+ hyprctl keyword "device[$TOUCHPAD]:enabled" true >/dev/null
+ echo "enabled" > "$STATE_FILE"
+ notify info "Touchpad" "Enabled"
+fi
+
+# Refresh the waybar indicator immediately (custom/touchpad listens on signal 9).
+pkill -RTMIN+9 waybar 2>/dev/null