Tablet Hardware Buttons
The X41 Tablet hardware buttons include:
- Power (with sliding lock)
- Cltr-Alt-Del [sic]
- Page up
- Page down
- Screen Rotation
- Tablet shortcut menu
X200 Tablet: see below.
The hardware buttons (except power) are recognized by the standard atkbd kernel driver which emits the following scancodes:
|Key||X41 Scancode||X60 Tablet Scancode||X61 Tablet Scancode||X200 Tablet Scancode||X201 Tablet Scancode|
- X200 Tablet
- Layout: power (with sliding lock); clockwise-arrow (formerly unlabeled); rotate (two boxes and an arrow); Toolbox (the icon is now a menu); padlock.
- The padlock button seems to do nothing. It generates no scancode, and has no effect on the other buttons.
- The clockwise-arrow button returns a scancode pair. So you say
$ setkeycodes e012 whatever.
- X201 Tablet
- Layout: as X200 Tablet
The utility setkeycodes can be used to map these scancodes to keycodes. Read
$ man setkeycodes for usage.
For example, the following command will map the page up and page down buttons to their respective keys:
# setkeycodes 6e 109 6d 104
Models featuring this Device
Configuration with xbindkeys
The xbindkeys utility can be used to bind actions to the buttons once they have key codes (which they have by default in Debian). This example is for an X200 Tablet running Debian Wheezy, but should be applicable to other models and distributions.
First create a default ~/.xbindkeysrc file with this command:
$ xbindkeys --defaults > ~/.xbindkeysrc
This file will contain the key bindings for each key, and the commands associated with them. More information on the file can be found on ArchWiki's Xbindkeys page.
Next, use the
$ xbindkeys -k command to generate the bindings to add to it. When the command is run, a window with a white background will appear. Select it and press the key you wish to bind. It will close and the binding will be printed to the terminal. For example (for the button):
"(Scheme function)" m:0x0 + c:161 NoSymbol
Copy and paste this into your ~/.xbindkeysrc file, replacing "(Scheme function)" with the command you wish to execute when the button is pressed.
A ~/.xbindkeysrc for an X200 Tablet might look like this:
# (Automatically generated documentation) # ... #Tablet Rotate button (run rotate script) "~/scripts/rotate.sh" # Replace the line above with the path to the script m:0x0 + c:161 NoSymbol #Tablet Toolbox button (show cellwriter) "cellwriter --show-window" m:0x0 + c:149 NoSymbol
This file binds the cellwriter input panel.button to a bash script that rotates the display (see below), and the button to the
The bindings will only work while
$ xbindkeys is running, however. Most desktop environments have a GUI to run commands at login. In Gnome 3, this is the Startup Applications app.
Screen rotation script
The example ~/.xbindkeysrc file above references a bash script that performs screen rotation. This is listed below:
#!/bin/bash tablet="Serial Wacom Tablet stylus" # Get the current orientation of the tablet rotate=$(xsetwacom get "$tablet" Rotate) # Work out the next tablet and screen orientations (rotating clockwise) case "$rotate" in none) nextRotate="cw" nextOrient="right" ;; cw) nextRotate="half" nextOrient="inverted" ;; half) nextRotate="ccw" nextOrient="left" ;; ccw) nextRotate="none" nextOrient="normal" ;; esac # Rotate the screen xrandr -o $nextOrient # Rotate the tablet xsetwacom set "$tablet" Rotate $nextRotate
Save this as a text file with the extension .sh somewhere on your system, mark it executable with
$ chmod +x <path to script>, and put the path in your ~/.xbindkeysrc, on the appropriate line.
You may have to replace "Serial Wacom Tablet stylus" with the name of your Wacom tablet. You can find this with the
$ xsetwacom list devices command.