Ever wished you could type with one hand?

Inspired by a post on xkcd, I wanted to try out my skills at a one handed keyboard. Sadly, the xkb file that's provided on that site messed some of the key up on my apple keyboard -- I could no longer use the arrow keys, for one.

So, I set out to make my own version of a mirror board that didn't mind which keyboard I was using. By using xmodmap, I've been able to do pretty much exactly what I wanted, which is now in my .mirrorboard.sh file that is set to run when I log in:

xmodmap -pke | sed -f ~/.mirrorboard.sed > ~/.Xmodmap2 
echo "keysym Super_L = Mode_switch" >> ~/.Xmodmap2
xmodmap ~/.Xmodmap2

This effectively prints out the current keymap, then replaces instances of each letter to be its the mirrored alternative, and then feeds the changes back into xmodmap. Since my apple keyboard has the Super_L key next to the space, it's pretty convenient to use that as the mode switcher.

The .mirrorboard.sed file looks like like this:

s/= q Q q Q/= q Q p P/g
s/= w W w W/= w W o O/g
s/= e E e E/= e E i I/g
s/= r R r R/= r R u U/g
s/= t T t T/= t T y Y/g

s/= a A a A/= a A semicolon colon/g
s/= s S s S/= s S l L/g
s/= d D d D/= d D k K/g
s/= f F f F/= f F j J/g
s/= g G g G/= g G h H/g

s/= grave asciitilde grave asciitilde/= grave asciitilde slash question/g
s/= z Z z Z/= z Z period greater/g
s/= x X x X/= x X comma less/g
s/= c C c C/= c C m M/g
s/= v V v V/= v V n N/g

s/= less greater less greater/= less greater BackSpace Delete/g

The result is that my keyboard now works in mirror mode when I hit the left super key. The only problem left is my complete inability to make good use of it. Here's my attempt at a standard phrase, with two hands on the top line, to compare with just one hand on the bottom. No cheating.

the quick brown fox jumped over the lazy white dog.
the qouick vnburwowvn jfox juvnmped over tghe sl;azy wgheite dog/.

Maybe that wasn't such a good idea after all...


Post a Comment