Archive for May, 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.)

The chemist and the Lynx – Part 1

Wednesday, May 12th, 2010

Longtime readers (all three of you) might have noticed that I run Ubuntu Linux on my computers.  There’s a new Ubuntu out – version 10.04 “Lucid Lynx”.  Now that my school is between semesters, I have a little time to get the new version up and running (and troubleshooted) before summer classes start.

Installation on a Thinkpad X61 Tablet

You don’t have to do it this way, but I usually back up my personal data and do a fresh install of a new operating system.  I chose the 32-bit version of Ubuntu because 64-bit Flash is still a work-in-progress at this point.  Plus, I use a few older 32-bit Windows applications under Wine for teaching, and they’re just easier to get running reliably with a 32-bit install.

As is typical with most recent Ubuntu releases, the initial install was painless.  Boot up with the CD and answer the questions.  That’s it.  All the X61 Tablet hardware that I actually use – including the pen – is functioning as soon as the installation is complete.

Essential software

The first thing you’ll want to do on any new Ubuntu system – and Lucid is no exception – is to install the usual multimedia tools.  At a minimum, you want to install the “restricted” packages:

sudo apt-get install ubuntu-restricted-extras

This will enable playback for most media files, install the freely available Microsoft web fonts, etc.  If you have a tablet like I do, you will also want cellwriter for handwriting recognition and xournal for note-taking and PDF annotation:

sudo apt-get install cellwriter xournal

Let the tweaking begin:  Fixing the new themes

Next, let’s have a look at the new Lucid desktop.  I don’t like dark desktop themes.  Therefore, I consider the default Ubuntu theme – “Ambiance” – to be an abomination.  Luckily, there’s a light version of the default theme, called “Radiance”.

Both of these new desktop themes could use some improvement.  One issue that bothered me immediately relates to active windows.  In most themes, the window that you are currently using – the “active” window – is distinguished from other visible windows by giving the title bar of the window a distinct appearance.

Here’s the default Radiance theme.

The Radiance theme, as shipped with Ubuntu Lucid 10.04

In the picture above, the terminal window (and not Firefox) is the active window, and will receive input from whatever keys you happen to press.  You can see that in an active window, the close button is orange.  You can also see that the active window is dark gray in the task bar.  These are small cues, though, and are not very useful when a lot of windows are open.

This is more minor, but the scrollbars on the Firefox window are also hard to see.

And then there’s the buttons. The window buttons (minimize, maximize, and close) have been moved to the left side … for what appears to be no good reason at all.  This might be great news for someone who is left-handed, but not for me.

I’m not a themes guru. but these details bothered me enough to hack the Radiance theme to make it more usable.  First, I borrowed some elements from the dark Ambiance theme and modified Radiance so that inactive windows would have a dark title bar and buttons, while the active window would be light.

I changed the scrollbars to match the orange-ish window close button, which makes them much easier to see and grab with the pen.

And the buttons?  Back where they belong.  The result looks like this.

Modified Radiance theme

(The active window in this screen shot is still the terminal window.)  As you can see, active and inactive windows now look different from one another.  No more confusion when transferring grades from my spreadsheet to our web-based system!

Want these modifications for your desktop? Download it here: [Modified Radiance theme – TAR archive]

To install this theme, download it, then extract the contents of the archive into /usr/share/themes.  The commands below should work on a default Lucid install

cd /usr/share/themes
sudo tar xf /home/[your user name here]/Downloads/radiance_2_3.tar

Then, select the “Radiance-2” theme from your System/Preferences/Appearance menu.

In Part 2, I’ll discuss making the stylus buttons do more interesting things