assigning a rotation script to a hardware button

7

1

I have a ThinkPad X201 tablet.

On the tablet there is a button that rotates the screen. It works great in Windows but doesn't work properly in Linux; it rotates the screen but doesn't rotate the wacom (stylus and finger touching)

The keycode (from showkeys) for the button is 154.

I'd like it to do the following bash script:

#!/bin/bash

xrandr -o right
xsetwacom set "Serial Wacom Tablet stylus" Rotate CCW
xsetwacom set "Serial Wacom Tablet eraser" Rotate CCW
exit 0

I have two questions:

  1. How can assign a script to the button? (#154)
  2. How can I run this assignment on startup?

kirill_igum

Posted 2011-09-27T19:01:26.913

Reputation: 1 098

Answers

2

This is usually done via ACPI calls. First of all make sure that acpid daemon is installed and running. Then you will need to create rule for it to start your script when button is pressed. The tricky part here is to identify the button name. You can do it by running acpid daemon in foreground with debugging enabled and then press the button. If you see some messages then write down the button name and use it to write a rule that calls your custom script. Read man acpid for details.

dtoubelis

Posted 2011-09-27T19:01:26.913

Reputation: 136