Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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?
share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.