diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/tablet | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/tablet')
| -rwxr-xr-x | debian/.local/bin/tablet | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/debian/.local/bin/tablet b/debian/.local/bin/tablet new file mode 100755 index 0000000..1b4e556 --- /dev/null +++ b/debian/.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 |
