diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-24 20:35:27 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-24 20:35:27 +0900 |
| commit | c80a54e42b52ce297f0f2f71af23c562832025c7 (patch) | |
| tree | dcce8bb977a770f473325d48f6f70b21d9818a40 /ar/.local/bin/tablet | |
init
Diffstat (limited to 'ar/.local/bin/tablet')
| -rwxr-xr-x | ar/.local/bin/tablet | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ar/.local/bin/tablet b/ar/.local/bin/tablet new file mode 100755 index 0000000..1b4e556 --- /dev/null +++ b/ar/.local/bin/tablet @@ -0,0 +1,39 @@ +#!/bin/sh + +# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. +rotation="$(xrandr -q --verbose | grep 'connected' | grep -Eo '\) (normal|left|inverted|right) \(' | grep -Eo '(normal|left|inverted|right)')" +penstylus="$(xsetwacom list devices | grep 'Pen' | grep 'stylus' | sed 's/\s*id.*//g')" +penerase="$(xsetwacom list devices | grep 'Pen' | grep 'erase' | sed 's/\s*id.*//g')" +fingertouch="$(xsetwacom list devices | grep 'Finger' | grep 'touch' | sed 's/\s*id.*//g')" + +# Using current screen orientation proceed to rotate screen and input tools. +case "$rotation" in +normal) + # rotate to the left + xrandr -o left + xsetwacom set "$penstylus" rotate ccw + xsetwacom set "$penerase" rotate ccw + xsetwacom set "$fingertouch" rotate ccw + ;; +left) + # rotate to normal + xrandr -o inverted + xsetwacom set "$penstylus" rotate half + xsetwacom set "$penerase" rotate half + xsetwacom set "$fingertouch" rotate half + ;; +inverted) + # rotate to normal + xrandr -o right + xsetwacom set "$penstylus" rotate cw + xsetwacom set "$penerase" rotate cw + xsetwacom set "$fingertouch" rotate cw + ;; +right) + # rotate to normal + xrandr -o normal + xsetwacom set "$penstylus" rotate none + xsetwacom set "$penerase" rotate none + xsetwacom set "$fingertouch" rotate none + ;; +esac |
