#!/bin/bash #### rotate.sh - A script for tablet PCs to rotate the display. ## This software is licensed under the CC-GNU GPL. ## http://creativecommons.org/licenses/GPL/2.0/ ## http://wiki.archlinux.org/index.php/Tablet_PC ## REQUIRES: linuxwacom (http://linuxwacom.sourceforge.net/) #### Function(s) function set_normal { xrandr -o normal xsetwacom set "stylus" Rotate 0 xsetwacom set "cursor" Rotate 0 xsetwacom set "eraser" Rotate 0 orientation="normal" } function set_right { xrandr -o right xsetwacom set "stylus" Rotate 1 xsetwacom set "cursor" Rotate 1 xsetwacom set "eraser" Rotate 1 orientation="right" } function set_left { xrandr -o left xsetwacom set "stylus" Rotate 2 xsetwacom set "cursor" Rotate 2 xsetwacom set "eraser" Rotate 2 orientation="left" } function set_inverted { xrandr -o inverted xsetwacom set "stylus" Rotate 3 xsetwacom set "cursor" Rotate 3 xsetwacom set "eraser" Rotate 3 orientation="inverted" } #### Variable(s) orientation="$(xrandr --query --verbose | grep '(normal left inverted right)' | awk '{print $5}')" #### Main if [ "$orientation" = "normal" ]; then set_right elif [ "$orientation" = "right" ]; then set_inverted elif [ "$orientation" = "inverted" ]; then set_left elif [ "$orientation" = "left" ]; then set_normal fi #### EOF