summaryrefslogtreecommitdiff
path: root/touchpad.sh
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2025-07-15 21:01:25 -0500
committerzachir <zachir@librem.one>2025-07-15 21:01:25 -0500
commit728bfc73a762bc53f843e3c7c15700ad3bf0a7f3 (patch)
tree82e49a3a51e2d6b9c45ee5758dacafa204c648e0 /touchpad.sh
parent7078e8ec74cf1fc02b041134fd57caf40506ef78 (diff)
Move some of my scripts out of bin to here
Diffstat (limited to 'touchpad.sh')
-rwxr-xr-xtouchpad.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/touchpad.sh b/touchpad.sh
new file mode 100755
index 0000000..bb864e9
--- /dev/null
+++ b/touchpad.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$HOME/.local/share}"
+export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"
+
+enable_touchpad() {
+ printf "true" >"$STATUS_FILE"
+ notify-send -u normal "Enabling touchpad"
+ hyprctl keyword '$LAPTOP_TP_ENABLED' "true" -r
+}
+
+disable_touchpad() {
+ printf "false" >"$STATUS_FILE"
+ notify-send -u normal "Disabling touchpad"
+ hyprctl keyword '$LAPTOP_TP_ENABLED' "false" -r
+}
+
+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