Saturday, 26 December 2009

Polish hardware keyboard layout for Nokia N900

Although Nokia N900 has support for Polish UI and input language out-of-the-box, every Polish user of this device would most definitely agree that typing anything that involves specific Polish characters like żażółć gęślą jaźń is a huge pain. For those who don't know - every national char has to be entered via little on-screen virtual keypad that appears after pressing Fn+Ctrl keyboard combination.

Maemo5's (in)convenient virtual keypad to type Polish chars

Obviously, There Is a Bugzilla Entry For That, but I have recently came across a blog post that sparkled an idea in my head. The basic idea is to hack around xkb config files and create a custom keyboard layout that would allow typing Polish letters directly from hardware keyboard rather than that nasty virtual keypad. Please note I did know nothing about xkb configuration before, hence the solution below is very far from perfect - but it works.


Here it is then: rx-51. This is hacked xkb config file that describes keyboard layout for N900. It needs to be placed in


directory (it obviously requires root shell access), overwriting already-existing rx-51 file. Making backup copy of original file might be good idea. To make it work straight away, execute following command (again, as root):

setxkbmap pl

This hack completely removes virtual keypad from the screen when Fn+Ctrl keys are pressed. To type Polish chars, press & hold Fn+Ctrl and then a letter, say Fn+Ctrl->A = ą or Shift->Fn+Ctrl->N = Ń etc.

Now, other keys that were originally on virtual keypad have been also remapped to hardware keyboard. Assuming Fn+Ctrl are already pressed:
  • T/5 -> % (hint: look where % sign is on regular PC keyboard)
  • I/8 -> TAB (that came from X-Terminal, where Ctrl-I already gives Tab)
  • P -> | (hint: p as pipe)
  • . -> <
  • , -> >
  • F -> [
  • G -> ]
  • H -> {
  • J -> }
  • M -> ~

There are few keys from virtual keypad missing, but I didn't really feel them as that important. I can (and probably will) add them later.

Known issues
  • This is just a hack and NOT a definitive solution that would be seen in any future software update from Nokia (in fact, software update from Nokia will most likely wipe this hack out). Also, this hack has NOT been thoroughly tested yet, I've finished implementation literally an hour before writing this post and haven't received any feedback whatsoever yet, so YMMV and potential side-effects are not known.
  • I'd rather set this up in a way that simultaneous pressing of Fn and Ctrl wasn't necessary (try type Ą, you see what I mean), pressing Fn then Ctrl then letter separately instead, but I just didn't know how to set this up. (Btw, getting head around xkb is like rocket science.)
  • For some weird reason typing Fn+Ctrl->H/J/M/Space produces double input on the screen. Initially I've assigned Tab to Fn+Ctrl->Space, but that produced ~[Tab] output, where only [Tab] was expected. Very weird, and I'm wondering whether that's some internal bug of the platform?
  • Having said these issues, any feedback from xkb experts would be more that appreciated. :) Thanks!

Additional rx-51 file modified and sent in by Grzegorz Jablonski (many thanks!), which adds following keyboard shortcuts:
  • Fn+Z -> Insert
  • Fn+X -> Escape
  • Fn+Ctrl+Q -> `
  • Fn+Ctrl+Y -> ^
  • Fn+Up -> PgUp
  • Fn+Down -> PgDown
  • Fn+Left -> Home
  • Fn+Right -> End
Useful resources

As I said, cracking xkb as a subject overall was somewhat like rocket science but I digged out few useful articles and tutorials that contribute to this solution: (source xkb config files, including original rx-51 one, so there is a permanent backup)

1 comment:

  1. Hello evad,

    Your keyboard works perfectly. There is also no problem with on-screen keyboard.
    It shows when it's necessary.
    Solutions like this make N900 a useful device instead of piece of shit, what was in the box delivered from Nokia.

    Once again many thanx

    Adam Sudoł