#!/usr/bin/env bash
# Toggles touchpad using Hyprland device keyword.
set -euo pipefail
dev="$(hyprctl -j devices | jq -r '.touchpads[0].name')"
[[ -z "$dev" || "$dev" == "null" ]] && exit 0
state=$(hyprctl getoption "device:$dev:enabled" -j | jq -r '.int')
if [[ "$state" -eq 1 ]]; then
  hyprctl keyword "device:$dev:enabled" 0
  notify-send -a waybar "Touchpad" "Disabled"
else
  hyprctl keyword "device:$dev:enabled" 1
  notify-send -a waybar "Touchpad" "Enabled"
fi

