summaryrefslogtreecommitdiff
path: root/dotfiles/system/.local/bin/toggle-touchpad
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-05-21 22:01:35 -0500
committerCraig Jennings <c@cjennings.net>2025-05-21 22:01:35 -0500
commitb4463015b97912658d630377fafbf630f7588d1e (patch)
treed04b66d992fe2ce88391889c21c5d8dc97acd0ef /dotfiles/system/.local/bin/toggle-touchpad
parent548154ea395356868e87980b149dfc0abdc84e17 (diff)
moving arch dotfiles into archsetup
Diffstat (limited to 'dotfiles/system/.local/bin/toggle-touchpad')
-rwxr-xr-xdotfiles/system/.local/bin/toggle-touchpad16
1 files changed, 16 insertions, 0 deletions
diff --git a/dotfiles/system/.local/bin/toggle-touchpad b/dotfiles/system/.local/bin/toggle-touchpad
new file mode 100755
index 0000000..9dde99b
--- /dev/null
+++ b/dotfiles/system/.local/bin/toggle-touchpad
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Toggle touchpad status
+# Using libinput and xinput
+
+# Use xinput list and do a search for touchpads. Then get the first one and get its name.
+device="$(xinput list | grep -P '(?<= )[\w\s:]*(?i)(touchpad|synaptics)(?-i).*?(?=\s*id)' -o | head -n1)"
+
+# If it was activated disable it and if it wasn't disable it
+if [[ "$(xinput list-props "$device" | grep -P ".*Device Enabled.*\K.(?=$)" -o)" == "1" ]]
+then
+ xinput disable "$device"
+ notify-send "Touchpad" "Touchpad disabled"
+else
+ xinput enable "$device"
+ notify-send "Touchpad" "Touchpad enabled"
+fi