Friday 11 May 2012

Rotating the display

In order to rotate the display I'm using XRandR.

This requires adding RandR support in /etc/X11/xorg.conf. The final "Device" section needs the RandRRotation option setting to true:

Section "Device"
        Identifier     "Device0"
        Driver         "nvidia"
        VendorName     "NVIDIA Corporation"
        BoardName      "Quadro NVS 110M"
        Option  "NoLogo"        "True"
        Option  "RandRRotation" "true"
EndSection

With that set, the screen orientation can be set by:

xrandr -o normal
xrandr -o right
xrandr -o inverted
xrandr -o left

Creating the following script as /etc/acpi/local/lid.sh.post means that whenever the screen is "opened", the screen reverts to normal rotation:

#!/bin/sh
stylus="Serial Wacom Tablet stylus"
eraser="Serial Wacom Tablet eraser"

# Check if the lid is now "open"
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
    xrandr -o normal
    xsetwacom set "$stylus" rotate none
    xsetwacom set "$eraser" rotate none
    xinput set-prop "$stylus" "Wacom Hover Click" 0
fi

Remember to chmod +x /etc/acpi/local/lid.sh.post

xsetwacom is used to set the orientation of the Wacom digitizer to match the screen orientation.

No comments:

Post a Comment