Tablet Hardware Buttons

From ThinkWiki
Revision as of 14:50, 21 November 2020 by Bugmenot2 (Talk | contribs) (added more models)

Jump to: navigation, search

X41 tablet HW buttons.JPG

Tablet Hardware Buttons

The 2-in-1 convertible ThinkPads includes push-buttons located on the bottom of the display panel's bezel. They are specifically designed to be used when the ThinkPad is in tablet mode, although they are still accessible when in laptop mode.

These buttons are supposed to act as a temporary keyboard replacement when in tablet mode, as the keyboard is completely inaccessible in that mode.


Not all 2-in-1 convertibles feature the same amount of buttons, some even output different scancodes/keycodes as well due to their functions' being changed.

For the X41 Tablet, there are 8 buttons in total: the power button with a sliding lock, a Ctrl-Alt-Del shortcut button, a Screen Rotation button, a Tablet shortcut menu button, an Escape button, an Enter button, and the Page up and down buttons.

The X60 Tablet and the X61 Tablet were given a reduced set of buttons, likely for the purpose of cutting down on costs. So far, there are 5 buttons in total: the power button with a sliding lock, a Ctrl-Alt-Del shortcut button, the Escape button, and a circular directional pad.

The X200 Tablet, X201 Tablet, and the X201i Tablet had the same amount of buttons as the X60 Tablet and the X61 Tablet. However, the directional pad was removed in favor of a padlock button that seems to do nothing (doesn't generate a scancode and doesn't affect the other buttons' operations). Due to the directional pad's removal, the buttons were once again changed in functionality. While the power button and its sliding lock remained the same, the other buttons were not functionally identical. For example, the Ctrl-Alt-Del shortcut function was replaced with a 180-degree rotate function, and the Escape button's functionality was replaced with a portrait/landscape switch function. The last button that was modified was the Tablet shortcut menu button, which now launches the ThinkVantage toolbox as opposed to a special tablet menu.

The X220 Tablet, X220i Tablet, X230 Tablet, and the X230i Tablet were given a reduction in buttons again, possibly to reduce cost. It was worse than the previous generation's 5-button set, as they all had only 3 buttons: the power button with no sliding lock, a 180-degree rotate button, and the portrait/landscape switch button.

Linux support

The hardware buttons (except power) are recognized by the standard atkbd kernel driver which emits the following scancodes:

Key X41 Tablet Scancode X60 Tablet Scancode X61 Tablet Scancode X200 Tablet Scancode X201 Tablet
X201i Tablet Scancode
X220 Tablet
X220i Tablet Scancode
X230 Tablet
X230i Tablet Scancode
Page up 0x6D NA NA NA NA NA NA
Page down 0x6E NA NA NA NA NA NA
Enter 0x69 0x69 0x69 NA NA NA NA
Esc 0x6B 0x6B 0x6b NA NA NA NA
Toolbox 0x68 0x68 0x68 0x66 0x68 NA NA
Rotate 0x6C 0x6c 0x6c 0x6b 0x6c TBD TBD
Ctrl-Alt-Del (Unlabeled) 0x67 NA 0x67 0xe0 0x12 0x67 NA NA
Padlock NA NA NA (nothing?) 0x66 NA NA
Right NA 0x6D 0x6d NA NA NA NA
Left NA 0x6E 0x6e NA NA NA NA
Up NA 0x71 0x71 NA NA NA NA
Down NA 0x6F 0x6f NA NA NA NA

Notes: 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

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. For support status, see the Tablet Screen Rotation Support page.

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 Tablet rotate button):

"(Scheme function)"
    m:0x0 + c:161

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)
# Replace the line above with the path to the script
    m:0x0 + c:161

#Tablet Toolbox button (show cellwriter)
"cellwriter --show-window"
    m:0x0 + c:149

This file binds the Tablet rotate button to a bash script that rotates the display (see below), and the Tablet shortcut button to the cellwriter input panel.

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:

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" ;;

# 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.

For more information regarding these buttons, see the How to get special keys to work page.

Models featuring this technology