Difference between revisions of "Tablet Hardware Buttons"

From ThinkWiki
Jump to: navigation, search
(unified content and merged things)
(unified layout)
Line 72: Line 72:
{{cmdroot|setkeycodes 6e 109 6d 104}}
{{cmdroot|setkeycodes 6e 109 6d 104}}
==Models featuring this Device==
* {{X41_Tablet}}, {{X60t}}, {{X61_Tablet}}, {{X200_Tablet}}, {{X201_Tablet}}
==Configuration with xbindkeys==
==Configuration with xbindkeys==
Line 144: Line 141:
You may have to replace <tt>"Serial Wacom Tablet stylus"</tt> with the name of your Wacom tablet. You can find this with the {{cmduser|xsetwacom list devices}} command.
You may have to replace <tt>"Serial Wacom Tablet stylus"</tt> with the name of your Wacom tablet. You can find this with the {{cmduser|xsetwacom list devices}} command.
==Models featuring this Device==
* {{X41_Tablet}}, {{X60t}}, {{X61_Tablet}}, {{X200_Tablet}}, {{X201_Tablet}}
==See also==
==See also==

Revision as of 19:35, 30 May 2013

Tablet Hardware Buttons

The Thinkpad tablets includes hardware buttons located on the LCD screen bezel. They are designed to be used when the ThinkPad is converted to the tablet configuration (though they are still accessible when in the laptop configuration).

Hardware Buttons of an X41 Tablet

Buttons' Layout

X41 Tablet

  • Power (with sliding lock)
  • Cltr-Alt-Del
  • Screen Rotation
  • Tablet shortcut menu
  • Escape
  • Enter
  • Page up
  • Page down

X61 Tablet

picture from here.

X200/X201 Tablet

  • Power (with sliding lock)
  • Clockwise-arrow (formerly unlabeled)
    • The clockwise-arrow button returns a scancode pair. So you say $ setkeycodes e012 whatever.
  • 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.

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 Scancode
Page up 0x6D NA NA NA NA
Page down 0x6E NA NA NA NA
Enter 0x69 0x69 0x69 NA NA
Esc 0x6B 0x6B 0x6b NA NA
Toolbox 0x68 0x68 0x68 0x66 0x68
Rotate 0x6C 0x6c 0x6c 0x6b 0x6c
(Unlabeled) 0x67 NA 0x67 0xe0 0x12 0x67
Padlock NA NA NA (nothing?) 0x66
Right NA 0x6D 0x6d NA NA
Left NA 0x6E 0x6e NA NA
Up NA 0x71 0x71 NA NA
Down NA 0x6F 0x6f 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.

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.

Models featuring this Device

See also