aboutsummaryrefslogtreecommitdiff
path: root/scripts/left-mode.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/left-mode.sh')
-rwxr-xr-xscripts/left-mode.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/left-mode.sh b/scripts/left-mode.sh
new file mode 100755
index 0000000..b5c8a22
--- /dev/null
+++ b/scripts/left-mode.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+device_id=$(
+ xinput list |
+ grep -i 'Optical Mouse' |
+ sed -n 's/.*id=\([0-9]\+\).*/\1/p' |
+ head -n 1
+)
+
+if [[ -z "$device_id" ]]; then
+ echo "Error: No device matching 'Optical Mouse' found." >&2
+ exit 1
+fi
+
+echo "Found Optical Mouse with ID: $device_id"
+
+xinput set-prop "$device_id" "libinput Left Handed Enabled" 1