Comment 3 for bug 159026

Revision history for this message
Florian Hackenberger (f-hackenberger) wrote : Re: Lenovo Thinkpad x41 Tablet and X60 Tablet rotate events

I'd like to propose the following additions in order to support panel rotation:

/etc/acpi/events/thinkpad-swivel-panel-down
--------------------------------------------------------
# called when tablet head swivels down
event=ibm/hotkey HKEY 00000080 00005009
action=/etc/acpi/swivel-panel-down.sh
EOF
--------------------------------------------------------

/etc/acpi/events/thinkpad-swivel-panel-up
--------------------------------------------------------
# called when tablet head swivels up
event=ibm/hotkey HKEY 00000080 0000500a
action=/etc/acpi/swivel-panel-up.sh
EOF
--------------------------------------------------------

/etc/acpi/swivel-panel-down.sh
--------------------------------------------------------
#!/bin/sh
#/etc/acpi/swivel-panel-down.sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

for x in /tmp/.X11-unix/*; do
    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
    getXuser;
    if [ x"$XAUTHORITY" != x"" ]; then
        export DISPLAY=":$displaynum"
        /usr/bin/xrandr --output LVDS --rotate inverted
        /usr/bin/xsetwacom set stylus rotate 3
    fi
done
--------------------------------------------------------

/etc/acpi/swivel-panel-up.sh
--------------------------------------------------------
#!/bin/sh
#/etc/acpi/swivel-panel-down.sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

for x in /tmp/.X11-unix/*; do
    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
    getXuser;
    if [ x"$XAUTHORITY" != x"" ]; then
        export DISPLAY=":$displaynum"
        /usr/bin/xrandr --output LVDS --rotate normal
        /usr/bin/xsetwacom set stylus rotate 0
        killall cellwriter
    fi
done
--------------------------------------------------------

Works fine on a T61t here.