#!/usr/bin/env bash # State file lives in the user's runtime dir (tmpfs, cleared on logout). # Using XDG_RUNTIME_DIR avoids /tmp collisions on multi-user systems. export STATUS_FILE="$XDG_RUNTIME_DIR/keyboard.status" enable_keyboard() { printf "true" >"$STATUS_FILE" notify-send -u normal "Enabling Touchpad" # `hyprctl keyword` changes a live config value over IPC without reloading. # The device name in square brackets scopes the change to that input device only. hyprctl keyword 'device[synaptics-tm3053-009]:enabled' "true" } disable_keyboard() { printf "false" >"$STATUS_FILE" notify-send -u normal "Disabling Touchpad" hyprctl keyword 'device[synaptics-tm3053-009]:enabled' "false" } # If no status file exists yet, treat as "enabled" (first run after login). if ! [ -f "$STATUS_FILE" ]; then enable_keyboard else # Toggle based on the persisted state: true → disable, false → enable. if [ $(cat "$STATUS_FILE") = "true" ]; then disable_keyboard elif [ $(cat "$STATUS_FILE") = "false" ]; then enable_keyboard fi fi