January 2018

S M T W T F S
  123456
78910111213
14151617181920
21222324252627
28293031   

Style Credit

Expand Cut Tags

No cut tags
Saturday, February 16th, 2008 08:27 pm
A while ago, I was playing about with my flatmate's shiny new eeePC. Impressive, I thought, but the keyboard's a bit of a fiddle - the keys are just a bit too small for my fingers (which are neither fat nor stumpy). Plus, the machine seems practically custom-designed to be balanced on one hand and operated with the other, and typing on a proper keyboard with only one hand is nothing short of an offence against all that is Good and Righteous. Surely there's a better method for one-handed text input onto such a small device?

Well, yes there is, as it happens. I'm talking about chording keyboards. In a normal keyboard, each key stands for one character, and your fingers move about from key to key; in a chording keyboard, your fingers stay fixed, and you indicate different characters by pressing combinations of keys. It's a generalised version of what the shift key does. Chording keyboards apparently take some getting used to, but allow for very high-speed and natural text input. Here's Stephen Fry talking about the chording keyboard on an early PDA:


My obsession with SmartPhones began many, many years ago. Certainly well before such devices existed in the real world. From the first Sharp contact-and-calendar “electronic organisers” , through the early Psions, the sadly missed AgendA (see above: no QWERTY there, more a kind of weird courtroom stenographer’s chord-based input pad: never have I been able to write faster than with that splendid object - I had another device using the same input system called, I think, Qinky, which connected to the Centronix port of a BBC Micro), to the opening salvo of Palm Pilots, Apple’s Newton and the arrival of Handspring. If they existed I had to have them. Had to.
[The rest of the article's well worth reading. And I see Stephen Fry now has an eee, too...]

Now, hardware chording keyboards still exist, and some of them speak USB: there's a problem, however, in that all the ones I can find are ridiculously expensive. Like, several hundred pounds. There are instructions for making your own online, but my soldering iron's in Oxford and I'd clearly never get round to it anyway. But then it struck me - we've got a perfectly good set of buttons sitting there on the machine already, we don't need any extra hardware! Have the keys H, J, K, L and Space work as a chording keyboard - that's (2^5 - 1) = 31, combinations, which is enough for the English alphabet plus, say, ",", ".", space, "?", and "'". We could deal with capital letters in the way that text-messaging software does, by making the combination ". " put the next character into upper-case, and possibly by making Shift sticky. We can just have the remaining keys self-insert as normal, so we don't have to do anything very cunning about characters that aren't in the subset represented by chords - I probably type the { key a lot more than most people, but I don't think I'd mind switching to one-fingered typing for that. I wasn't really thinking of this as an input method for heavy coding, anyway. The obvious encoding system to use would be Baudot, or something based on it, but I'm open to suggestions.

All fine in theory; but how would I go about writing such a thing? Or does one exist already? I had a brief look, but given all the different meanings of "chord", I didn't see anything very promising. I'd thought about writing an Emacs minor mode to handle the chording, but (a) I don't know my way round the Emacs codebase, (b) I don't actually use Emacs (and does it even run on the eee?), and (c) it seems like the Right Thing would be to use XIM (X Input Methods). Unfortunately, XIM documentation appears to be... well, have a look for yourself. And the thought of writing low-level X code in C fills me with fear and loathing - OK, OK, I'm a wuss who's been spoiled by high-level languages.

Does anyone have any advice? And does anyone fancy doing it for me joining in?
ext_3241: (Default)
[identity profile] pizza.maircrosoft.com (from livejournal.com)
Saturday, February 16th, 2008 10:25 pm (UTC)
if I followed you right, you can do the chording using compose sequences. see for example http://cyberborean.wordpress.com/2008/01/06/compose-key-magic/ . I just tested it with the addition of (compose:caps) to my xorg.conf and ... the following ...

mair@pyrite:~  $ cat .XCompose
# ~/.XCompose
# This file defines custom Compose sequence for Unicode characters 

# Import default rules from the system Compose file:
include "/usr/share/X11/locale/en_US.UTF-8/Compose"

<Multi_key> <J> <J>     :"a"
<Multi_key> <J> <K>     :"b"
<Multi_key> <J> <L>     :"c"
<Multi_key> <J> <;>     :"d"
<Multi_key> <J> <space> :"e"


but then you want some magic to have the compose key appear permanently pressed. I wonder if you can define an empty compose key...

for the sticky shift I wonder if you can do it using groups (just been reading http://www.charvolant.org/~doug/xkb/html/node3.html#SECTION00032000000000000000)

i.e. have the keyboard map (modify with xmodmap or something) define two groups; have group one have five (arbitrary) characters that combine using the compose to make lowercase letters, and have group two define five (arbitrary) characters that combine to make uppercase letters. that seems a bit ugly but ugly hacks are my strong point.

then you just need to map shift to switch groups, I have no idea how that is done. I expect it is possible if you can map arbitrary keys to run arbitrary commands ... xbindkeys (http://hocwp.free.fr/xbindkeys/xbindkeys.html) maybe...

somehow this doesn't seem the kind of solution that should satisfy a haskell programmer.

my tea is now cold.
ext_3241: (Default)
[identity profile] pizza.maircrosoft.com (from livejournal.com)
Saturday, February 16th, 2008 10:26 pm (UTC)
(I should have used lowercase etc)
Saturday, February 16th, 2008 10:39 pm (UTC)
For those reading: that should have been "lowercase <J>".

By the way - how did you find this blog?
ext_3241: (Default)
[identity profile] pizza.maircrosoft.com (from livejournal.com)
Saturday, February 16th, 2008 11:09 pm (UTC)
when I had a LJ I used to stalkread atreic's friends because they were more interesting than mine. now I don't have a LJ I have even more reason to read other people's f'lists when I get bored. especially if they write posts about functional programming.
Sunday, February 17th, 2008 12:21 am (UTC)
Are you a friend of [livejournal.com profile] atreic's, then? How do you know her? She does seem to know the most surprising people.
ext_3241: (Default)
[identity profile] pizza.maircrosoft.com (from livejournal.com)
Sunday, February 17th, 2008 11:04 am (UTC)
I don't know [livejournal.com profile] atreic well but I'd recognise her in the street. From somewhere on the edge of my ex's social circle, I think. before I moved away we may both have been people-who-occasionally-turn-up-in-the-Cambridge-Carlton; people-who-occasionally-turn-up-at-Cambridge-Ceilidhs (actually I only did that on one occasion, but I meant* to do it more).
Saturday, February 16th, 2008 10:35 pm (UTC)
Jesus, that was quick! And also promising, and surprisingly lightweight. I'll give that a go...

And I'm not really a Haskell programmer: I'm a Perl-writing mathematician who hangs around with Haskell programmers and spends far too much time and effort trying to work out why they think it's so great :-)

Sorry about the tea :-(
Sunday, February 17th, 2008 07:20 am (UTC)
Hmmmmmm. That's an absolutely fascinating problem :-) I wish I could help but looking at that XIM documentation terrifies me...
Sunday, February 17th, 2008 08:54 am (UTC)
Could the scroll lock be commandeered to lock the chording option?
Sunday, February 17th, 2008 08:35 pm (UTC)
Personally I find H U I O (on my spanish QWERTY keyboard) a more natural position for my right hand.

Also, remember that there was a mnemonic memory for the different letter key combinations: http://www.bellaire.demon.co.uk/bellaire_cykey_codes.html

I suspect the biggest problem really is deciding when a chord is a chord. You have to store the various keydown events until the first keyup, and then resolve it into a letter. Not sure if the compose-key trick above would work correctly with that, but at the very minimum you'd have to include all the possible combinations of the three, four, or five keys making up a chord.

Anyway, that site has a lot of stuff on the AgendA which may help you...