Files
dotfiles/.config/waybar/scripts/touchpad_status.sh
2025-09-19 18:25:11 +02:00

15 lines
471 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
dev="$(hyprctl -j devices | jq -r '.touchpads[0].name')"
if [[ -z "$dev" || "$dev" == "null" ]]; then
echo '{"text":"󰍽","tooltip":"No touchpad detected","class":"absent"}'
exit 0
fi
state=$(hyprctl getoption "device:$dev:enabled" -j | jq -r '.int')
if [[ "$state" -eq 1 ]]; then
echo '{"text":"󰍿","tooltip":"Touchpad: enabled","class":"on"}'
else
echo '{"text":"󰜭","tooltip":"Touchpad: disabled","class":"off"}'
fi