Aku Kotkavuo

@eagleflo

Portrait

I am a software generalist from Helsinki, Finland. I’ve been working with software for most of my life. I practise writing about related topics here.

My open source projects include mpyq and jisho.


Keyboard layout

10th January 2015

Here is one very quick suggestion for all fellow Finnish programmers: change your keyboard layout. The default keyboard layout for Finnish is absolutely terrible for programming.

Adjusting your keyboard layout is not hard, and it will make a difference in your day-to-day programming activities, especially if you're using Apple's computers, where the braces are behind two modifier keys. No amount of apologism will make up for that.

Customizing your tools to fit you better is something we all should constantly strive for, but even most professional programmers I've dealt with use the system default keyboard layout. Most of the others have changed to the US layout completely, but that's a little extreme for me: I don't like the idea of putting ä and ö behind modifiers. What I do envy is the placement of brackets and braces, conveniently on the side. Standard Finnish keyboard layout maps å and diaeresis ¨ to those valuable keys!

I suggest a hybrid between the Finnish and US keyboard layouts, with Finnish keyboard layout acting as the basis for these modifications:

  • å → [
  • Å → {
  • ¨ → ]
  • ^ → }
  • AltGr + ^ → ^
  • AltGr + o → å
  • AltGr + O → Å
  • AltGr + u → ü
  • AltGr + U → Ü

While at it, I changed tilde and circumflex from dead keys to live ones, since practically every time I type those characters I just want that character.

With these tiny modifications, you get the greatest benefits of using US keyboard layout without the downsides. I've now been using this for a few years on all my computers; it took no time at all to get used to and comfortable with.

Using Qwerty is terrible for typing in general, but learning a whole new layout like Dvorak or Colemak is a much bigger proposition than switching a few keys around on the layout you already know.

Let's see how to do it!

Mac OS X

If you're happy with what I suggested above, I've already done the work for you. Just download this.

Otherwise, download Ukelele [sic] and create a new key map based on your current keyboard layout. Click on the keys you wish to modify, and after you're done save the new keyboard layout as a bundle.

Place the bundle in ~/Library/Keyboard Layouts/ and add a new input source from Preferences > Keyboard > Input sources.

(On OS X you can't remove the default keyboard layout from your input sources for some reason.)

Linux

This is a bit harder in Linux. I'm running Ubuntu 14.10 on the desktop for time being, so these instructions will reflect that. The first file you want to edit is /usr/share/X11/xkb/symbols/<language>. I appended this to the bottom of the file:

partial alphanumeric_keys
xkb_symbols "programmer" {
    include "fi(fi)"
    name[Group1]="Finnish (programmer)";

    key <AD07> { [ u, U, udiaeresis, Udiaeresis ] };
    key <AD09> { [ o, O, aring, Aring ] };
    key <AD11> { [ bracketleft, braceleft, oe, OE ] };
    key <AD12> { [ bracketright, braceright, asciitilde, asciicircum ] };
};

Then I tested the changes with setxkbmap 'fi(programmer)'. Once happy with everything, I edited /usr/share/X11/xkb/rules/evdev.xml and added the following:

<variant>
  <configItem>
    <name>programmer</name>
    <description>Finnish (programmer)</description>
  </configItem>
</variant>

After that, I added this one line to /usr/share/X11/xkb/rules/evdev.lst:

programmer      fi: Finnish (programmer)

These changes were necessary to add the Finnish (programmer) option to the Gnome Keyboard Settings. Select Finnish (programmer) as your input source and you're done.