2024-09-09 00:22:14 +00:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
|
|
|
# Toggle left-handed mouse
|
2024-09-15 22:42:24 +00:00
|
|
|
#?? left DEVICE
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-09-15 22:42:24 +00:00
|
|
|
# BUG: New hyprctl syntax does not support per-device getoption
|
|
|
|
# https://github.com/hyprwm/hyprlang/issues/43
|
|
|
|
# HACK: Condition based on file presence, requires creation at login to set state
|
|
|
|
#?? exec-once = left
|
|
|
|
FILE=/tmp/left
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-09-15 22:42:24 +00:00
|
|
|
if (("$#" == 0)); then
|
|
|
|
touch "$FILE"
|
|
|
|
exit
|
|
|
|
fi
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-09-15 22:42:24 +00:00
|
|
|
if [[ -f "$FILE" ]]; then
|
|
|
|
hyprctl keyword "device[$1]:left_handed" false
|
|
|
|
hyprctl keyword "device[$1]:natural_scroll" false
|
|
|
|
rm --force "$FILE"
|
|
|
|
notify-send "> left" "Right-handed" --urgency low
|
2024-09-09 00:22:14 +00:00
|
|
|
else
|
2024-09-15 22:42:24 +00:00
|
|
|
hyprctl keyword "device[$1]:left_handed" true
|
|
|
|
hyprctl keyword "device[$1]:natural_scroll" true
|
|
|
|
touch "$FILE"
|
|
|
|
notify-send "> left" "Left-handed" --urgency low
|
2024-09-09 00:22:14 +00:00
|
|
|
fi
|