Keyboard layouts - Scandinavian


I would like to hear opinions on keyboard layouts for programming.
I was brought up in the UK so was used to the UK keyboard layout, but worked at CERN in Switzerland where there was a very odd Swiss layout as I remember (I had a Falco terminal which switched between VT220 emulation and Tektronix. Think about that the next time you complain about Julia Plots in the REPL)

When I went to ASML in the Netherlands the whole company had decided to standardise on the US keyboard layout. Which was a Good Thing TM in my opinion.
When I bought a new laptop I made sure it had a US layout.

I am now working in Denmark and the Scandinavian layout drives me spare. I still cannot find the carat symbol (its there on a keycap above Ø … but …)
So a point for discussion. Programming languages, such as Julia, have a heavy reliance on symbols such as - > |
What are the opinions on keyboard layout for productivity?
Interested to hear from Julians who do not use the Roman alphabet in their mother languages also.


On a Swedish keyboard you do Shift + (key right of Å), I think it is the same on Danish.


Kristoffer, tak. That is really weird - I have to press Shift TWICE then the ^ symbol appears.
I have never met a keyboard which does that!

(Tak - one of my few Danish words. I hang my head in shame).


Where in Denmark? Happy to meet up and show you how our weird keyboards work :wink:

edit: for the new Pkg3 you’ll also want to know that ] is AltGr + 9


@pkofod I am in Bagsvaerd. Not at Novo Nordisk but next door at Novozymes. A bit of a Python shop really…
I knew a Per Kofod from SGI Are you related?

Also I know that Julia is being used by a company nearby for digital signal processing.



My native language is Hungarian, which has a lot of accents, but I find anything but the US layout suboptimal for programming. My compromise is the alt-intl layout in Xorg, I enable and disable it with CapsLock and Shift-CapsLock, and use 'a to type á, etc, whenever I have to type accented chars. The relevant snippet for xorg.conf.d is below.

Section "InputClass"
    Identifier "keyboard-all"
    Driver "evdev"
    Option "XkbLayout" "us,us"
    Option "XkbVariant" ",alt-intl"
    Option "XkbOptions" "compose:prsc,grp:shift_caps_switch,altwin:hyper_win,terminat$
    MatchIsKeyboard "on"

Also, it pays to learn some level of touch typing. This usually happens automatically. Using a single or a small number of keyboards (eg your laptop, office keyboard, possibly a home keyboard) also helps. Set everything to the same layout and ignore the labels on the keys.


I am also on a Swedish keyboard and can attest to the fact that it is extremely painful to do any kind of programming with. The main problem is that you need the AltGr key (immediately right of Space) to access all the following characters: [ ] { } ~ \ | $ @. And the keys you need to hit with AltGr are awkwardly situated in the top row under the number keys (or way to the left for |). Here’s an image of the layout we have to deal with.

But after many years of pain I finally have a solution I’m happy with. When programming, I switch to a custom keyboard layout which gives easy access to the keys you normally need AltGr with (all other keys are in the standard positions in the Swedish layout) and hide the default Swedish keys under AltGr instead. When typing in Swedish I switch back to the standard layout.

If anyone is interested, these are the keys I remap:

ö => [    ä => ]    Ö => {    Ä => }
å => \    Å => |    ¨ => ~    (not quotation but the diaeresis modifier key)
§ => @    ½ => $    (these are permanent remaps because § and ½ are completely useless)

Custom layouts can be created using Microsoft’s tool, and Windows lets you define keyboard shortcuts to quickly switch between layouts without touching the mouse. However, since I always have AutoHotKey running in the background for other reasons, I just do the remapping in an AHK script instead.

Believe me when I say it’s totally worth the hour or two of setup time you need to fix this problem once and for all.


Are you using Windows or Linux (or OS X…)?

I use the standard XKB Norwegian Dvorak layout with two alterations to get the tilde, circumflex, and dollar signs in “easy-to-access” positions. This works really well, but I dread the day that I start working in a place that won’t let me use Dvorak; my productivity will take a serious hit :stuck_out_tongue:

In the unlikely case that anybody is interested, my two changes to the XKB symbols file no is

key <AE04> { [4, dollar, currency, onequarter ] };
key <AD12> { [dead_diaeresis, dead_circumflex, dead_tilde, dead_caron ] };

It can also be achieved with .Xmodmap:

keycode  35 = asciitilde asciicircum dead_diaeresis dead_circumflex asciitilde dead_caron dead_tilde
keycode  13 = 4 dollar onequarter


I am using Ubuntu Linux. The place where I work doesn’t care about which keyboard I use. Its just there are Danish ones lying around.


I live in Sweden and routinely switch back to a us layout every time I code. It’s just easier.