aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/waybar-touchpad
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/hyprland/.local/bin/waybar-touchpad')
-rwxr-xr-xdotfiles/hyprland/.local/bin/waybar-touchpad15
1 files changed, 15 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/waybar-touchpad b/dotfiles/hyprland/.local/bin/waybar-touchpad
new file mode 100755
index 0000000..d3adddd
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/waybar-touchpad
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Touchpad on/off indicator for waybar.
+# Reads the state file that toggle-touchpad and touchpad-auto maintain; emits
+# one JSON line (text + tooltip + class) for the custom/touchpad module.
+# Anything other than "disabled" reads as enabled, so a missing or garbled
+# state file fails safe (pointer shown rather than hidden).
+
+STATE_FILE="${XDG_RUNTIME_DIR:-/tmp}/touchpad-state"
+state=$(cat "$STATE_FILE" 2>/dev/null || echo enabled)
+
+if [ "$state" = "disabled" ]; then
+ echo "{\"text\": \"<span size='large'>󰍾</span>\", \"tooltip\": \"Touchpad disabled\", \"class\": \"disabled\"}"
+else
+ echo "{\"text\": \"<span size='large'>󰍽</span>\", \"tooltip\": \"Touchpad enabled\", \"class\": \"enabled\"}"
+fi