blob: d3addddc3f5cc598e9c5cefd17d0c238973a4709 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
|