Archive for May 28th, 2010

The chemist and the Lynx – Part 2

Friday, May 28th, 2010

I’d indented to post this a bit earlier, but I’ve been scrambling lately to recover from the premature death of both my Thinkpad X61’s AC adapter and its 320 GB Hitachi hard drive.

When it rains, it pours.

Now I’m back online with a spare drive and another fresh Ubuntu 10.04 installation.  So now it’s time to get some more stuff working nicely.

Stylus buttons

Wouldn’t it be nice to have the thumb button on the stylus bring up a menu?  That way, you could use only the stylus to navigate the desktop without having to flip it over.  Ubuntu 10.04, unfortunately, does not provide any tool to change the functions of the stylus buttons.  But that doesn’t mean it can’t be done with a script:

#!/bin/bash
# Remap the side button to bring up context menu.
xsetwacom set "Serial Wacom Tablet" Button1 "button 1"
xsetwacom set "Serial Wacom Tablet" Button2 "button 3"
# Fix the "Serial Wacom Tablet eraser" button to paste
xsetwacom set "Serial Wacom Tablet eraser" Button1 "button 2"

If you save the script above (I saved it as stylusbuttons.sh), you can tell it to be run every time you log in to your desktop using the main menu option System->Preferences->Startup Applications.

Screen rotation

Sometimes it’s nice to use the X61 as a proper tablet – with the screen folded down and the desktop rotated.  Rotating the desktop is simple enough, but the stylus doesn’t rotate with the desktop – making the rotated desktop impossible to use.  This is something I wish Ubuntu would handle automatically, but it’s also something that can be done easily with a script:

#!/bin/bash
# Won't work if the display is something other than 1024x768
# Won't rotate if external monitor is connected
orientation=`xrandr -q | grep -c 1024x768`
if [ $orientation -eq 2 ]; then
   /usr/bin/X11/xrandr --orientation right
   xsetwacom set "Serial Wacom Tablet" Rotate CW
   xsetwacom set "Serial Wacom Tablet eraser" Rotate CW
else
   /usr/bin/X11/xrandr --orientation normal
   xsetwacom set "Serial Wacom Tablet" Rotate NONE
   xsetwacom set "Serial Wacom Tablet eraser" Rotate NONE
fi

Save this as rotation.sh .  It will rotate the desktop and the stylus, leaving you with a usable system.  If you run the same script again while the desktop is rotated, it will restore the desktop and stylus to their original orientation.  If you don’t want to open the terminal window to rotate your desktop, you can use an application launcher in the Gnome panel to run the script.

Fixing the screen saver

In Ubuntu 10.04, the screensaver locks the screen by default, requiring you to enter a password to unlock the screen.  This can be rather annoying on a rotated tablet, since the screen saver does not provide an on-screen keyboard to allow you to unlock the screen.  With so many mobile devices about, you’d think this issue would have been fixed by now, but so far it’s not been done.  It’s not that the screen saver doesn’t support an on-screen keyboard; it’s just that there is no obvious way to turn it on!

Here’s what you need to do:

Install cellwriter, which you have probably already done.  If not,

apt-get install cellwriter

Then, open up gconf-editor.

gconf-editor

Open the apps folder, then click gnome-screensaver.  Make sure the box beside embedded_keyboard_enabled is checked.  Then, click embedded_keyboard_command and set its value to this:

cellwriter --xid --keyboard-only

Now you can unlock the screen with your stylus!  (And you can also curse the Gnome developers for only half-fixing a major and easily-fixable accessibility problem.)