#!/bin/bash # On the HP, rotation is (normally) CW or NORMAL # # I can't claim this script as my own. Someone in some IRC # channel somewhere was nice enough to share this and I just # modified it. Unfortunately I don't remember who it was # that I got this from or I'd give them credit. x_min=0 x_max=24700 y_min=0 y_max=18520 function ROTATE() { curr=`xrandr | grep "^LVDS" | cut -d " " -f 4 | sed 's/(//'` case $curr in normal) CW ;; *) NORMAL ;; esac } function PORTRAIT() { #xsetwacom set eraser BottomX $x_max #xsetwacom set eraser BottomY $y_max echo portrait } function LANDSCAPE() { #xsetwacom set eraser BottomX $y_max #xsetwacom set eraser BottomY $x_max echo landscape } function NORMAL() { xrandr -o normal xsetwacom set stylus Rotate NONE xsetwacom set eraser Rotate NONE PORTRAIT compiz --replace } function CCW() { xrandr -o right xsetwacom set stylus Rotate CCW xsetwacom set eraser Rotate CCW LANDSCAPE } function CW() { kwin --replace & xrandr -o right xsetwacom set stylus Rotate CW xsetwacom set eraser Rotate CW LANDSCAPE } function INVERT() { xrandr -o inverted xsetwacom set stylus Rotate UD xsetwacom set eraser Rotate UD LANDSCAPE } case $1 in -l) CCW ;; -r) CW ;; -n) NORMAL ;; -i) INVERT ;; *) ROTATE ;; esac