Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Commented out lines aren't required on GNOME and some other DEs
- state=$(cat /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode) #This file here is an indicator of whether it's in tablet mode or laptop mode
- if mkdir /home/erik/.rot/.rot.sh.exclusivelock
- then
- # Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
- rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
- # Using current screen orientation proceed to rotate screen and input tools.
- if [[ "$state" == "1" ]]
- then
- if [[ "$rotation" == "inverted" ]]
- then
- # rotate to the left
- xrandr -o left
- #xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate ccw
- #xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate ccw
- #xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate ccw
- xsetwacom --set "Wacom ISDv4 E6 Pen stylus" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Pen eraser" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Finger touch" ResetArea
- elif [[ "$rotation" == "left" ]]
- then
- # rotate to be inverted
- xrandr -o inverted
- #xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate half
- #xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate half
- #xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate half
- xsetwacom --set "Wacom ISDv4 E6 Pen stylus" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Pen eraser" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Finger touch" ResetArea
- else
- xrandr -o inverted
- #xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate half
- #xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate half
- #xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate half
- xsetwacom --set "Wacom ISDv4 E6 Pen stylus" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Pen eraser" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Finger touch" ResetArea
- fi
- else
- if [[ "$rotation" == "inverted" ]]
- then
- xrandr -o normal
- #xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate none
- #xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate none
- #xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate none
- xsetwacom --set "Wacom ISDv4 E6 Pen stylus" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Pen eraser" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Finger touch" ResetArea
- else
- xrandr -o inverted
- #xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate half
- #xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate half
- #xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate half
- xsetwacom --set "Wacom ISDv4 E6 Pen stylus" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Pen eraser" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Finger touch" ResetArea
- fi
- fi
- sleep 1s
- rmdir /home/erik/.rot/.rot.sh.exclusivelock
- fi
- sleep 0.1s
- xsetwacom --set "Wacom ISDv4 E6 Pen stylus" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Pen eraser" ResetArea
- xsetwacom --set "Wacom ISDv4 E6 Finger touch" ResetArea
Advertisement
Add Comment
Please, Sign In to add comment