Share one implementation for the touchpad and touchscreen toggles
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fbb4cc16b1
commit
6aaa5b764e
@@ -3,30 +3,4 @@
|
||||
# omarchy:summary=Enable, disable, or toggle the touch functionality of the screen
|
||||
# omarchy:args=[on|off|toggle]
|
||||
|
||||
STATE_FILE="$HOME/.local/state/omarchy/toggles/hypr/touchscreen-disabled.lua"
|
||||
|
||||
device="$(omarchy-hw-touchscreen)"
|
||||
|
||||
if [[ -z $device ]]; then
|
||||
echo "No touchscreen device found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
enable() {
|
||||
hyprctl eval "hl.device({ name = \"$device\", enabled = true })" >/dev/null
|
||||
rm -f "$STATE_FILE"
|
||||
omarchy-osd -i touch -m "Touchscreen enabled"
|
||||
}
|
||||
|
||||
disable() {
|
||||
hyprctl eval "hl.device({ name = \"$device\", enabled = false })" >/dev/null
|
||||
mkdir -p "$(dirname "$STATE_FILE")"
|
||||
printf 'hl.device({ name = "%s", enabled = false })\n' "$device" >"$STATE_FILE"
|
||||
omarchy-osd -i touch -m "Touchscreen disabled"
|
||||
}
|
||||
|
||||
case "${1:-toggle}" in
|
||||
on) enable ;;
|
||||
off) disable ;;
|
||||
toggle) if [[ -f $STATE_FILE ]]; then enable; else disable; fi ;;
|
||||
esac
|
||||
exec omarchy-toggle-input-device touchscreen "${1:-toggle}"
|
||||
|
||||
Reference in New Issue
Block a user