DK programming keyboard layout


It all began on the Amiga where I started to use the US layout because my Amiga had an us/English keyboard. It also contained æ, ø and å. They were mapped at a,o and q.

When I got a PC (running Linux) and started to write in C++ and LaTeX I noticed the superiority of the US layout. One button ; / \ , I like shift better than Alt-Gr as well eg. {} were better too. However it did not contain æ, ø and å. I used the US layout as I don't use those characters that often anyway, but it was somewhat annoying. Therefor I decided to write a new layout, here it is:

Xorg started to use HAL, then udev for xorg confguration... time to update this page... again

The symbols

First we need to create a alternative symbol layout file.
Put the text from the box below into /usr/share/X11/xkb/symbols/dk_prog
partial alphanumeric_keys 
xkb_symbols "basic" {

    include "dk"

    // Describes the differences between a Danish keyboard 
    // and a Danish keyboard optimized for programming.

    name[Group1]= "Danish";
    key <AC01> {[a, A, ae, AE]};
    key <AD01> {[q, Q, aring, Aring]};
    key <AD09> {[o, O, oslash, Ooblique]};
    key <AC10> {[braceleft, minus]};
    key <AD11> {[semicolon, apostrophe]}; 
    key <AC11> {[braceright, greater]};
    key <BKSL> {[backslash, asterisk, dead_doubleacute, multiply]};
    key <AB10> {[slash, underscore, hyphen, macron ]};


This alters some keys, the changes are as follows:

Alt-Gr+q -> å
Alt-Gr+a -> æ
Alt-Gr+o -> ø

æø -> {}
Shift+æShift+ø -> ->

å -> ;
Shift+å -> '
' -> \
- -> /

Defining a layout

To the ! layout section of /usr/share/X11/xkb/rules/xorg.lst I then added dk_prog Den C++ below the dk Denmark entry.
I am not 100% sure that this part is needed...

Inside the <layoutList> section of /usr/share/X11/xkb/rules/xorg.xml I added the layout definition below.
        <description>DK for C++</description>
After doing this you can switch to the layout by using the command setxkbmap dk_prog.

Using the layout as default

HAL has been depricated in favour of udev.
/lib/udev/rules.d/64-xorg-xkb.rules states that it reads the configuration from /etc/default/console-setup
The line saying so:
ENV{ID_INPUT_KEY}=="?*", IMPORT{program}="/bin/grep ^XKB /etc/default/console-setup"

In the file /etc/default/console-setup just change the XKBLAYOUT line to:

Now your X starts with the dk_prog layout...