My keyboard layout

Other languages

I use a Dvorak layout, on an Apple Aluminum Keyboard (A1243), on a Gentoo Linux PC.

I could mostly do with the xorg-provided dvorak layout, by putting this in my xorg.conf file:

Section "InputClass"
 Identifier "keyboard-generic"
 Driver "evdev"
 Option "XkbOptions" "compose:ralt,altwin:meta_win,terminate:ctrl_alt_bksp"
 Option "XkbLayout"  "us"
 Option "XkbModel"   "evdev"
 Option "XkbVariant" "dvorak"

 MatchIsKeyboard "on"
EndSection

but a few keys were wrong: the "tilde" and "section" keys were swapped, the "fn" key was not recognized, and most function keys did not work.

For the "fn" key, I had to write a bit of code, but for the rest I only had to configure XKB properly.

Now my xorg.conf file contains:

Section "InputClass"
 Identifier "keyboard-generic"
 Driver "evdev"
 Option "XkbOptions" "compose:ralt,altwin:meta_win,terminate:ctrl_alt_bksp"

 MatchIsKeyboard "on"
EndSection

Section "InputClass"
 Identifier "keyboard-apple-alu"
 Driver "evdev"
 Option "XkbLayout"  "dakkar"
 Option "XkbModel"   "applealu_iso"
 Option "XkbVariant" "dvorak-apple-al"
 Option "event_key_remap" "464=118 120=210 204=211"

 MatchIsKeyboard "on"
 MatchProduct    "Apple, Inc Apple Keyboard"
EndSection

and I have a /usr/share/X11/xkb/symbols/dakkar file with:

default partial alphanumeric_keys
xkb_symbols "dvorak-apple-al" {

   name[Group1] = "USA Dvorak Apple Aluminium keyboard";

   include "us(dvorak)"

   key <TLDE> {        [   quoteleft,  asciitilde     ]       };

   key <LSGT> {        [   section,    plusminus      ]       };

   key <I232>  { [ XF86MonBrightnessDown, F1,  F1,  XF86_Switch_VT_1  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I233>  { [ XF86MonBrightnessUp,   F2,  F2,  XF86_Switch_VT_2  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I210>  { [ XF86Launch3,           F3,  F3,  XF86_Switch_VT_3  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I211>  { [ XF86Launch4,           F4,  F4,  XF86_Switch_VT_4  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I237>  { [ XF86KbdBrightnessDown, F5,  F5,  XF86_Switch_VT_5  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I238>  { [ XF86KbdBrightnessUp,   F6,  F6,  XF86_Switch_VT_6  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I173>  { [ XF86AudioPrev,         F7,  F7,  XF86_Switch_VT_7  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I172>  { [ XF86AudioPlay,         F8,  F8,  XF86_Switch_VT_8  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <I171>  { [ XF86AudioNext,         F9,  F9,  XF86_Switch_VT_9  ] , type[Group1] = "FOUR_LEVEL_X" };
   key <MUTO>  { [ XF86AudioMute,         F10, F10, XF86_Switch_VT_10 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <VOL->  { [ XF86AudioLowerVolume,  F11, F11, XF86_Switch_VT_11 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <VOL+>  { [ XF86AudioRaiseVolume,  F12, F12, XF86_Switch_VT_12 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK13>  { [ F13,                   F13, F13, F13 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK14>  { [ F14,                   F14, F14, F14 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK15>  { [ F15,                   F15, F15, F15 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK16>  { [ F16,                   F16, F16, F16 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK17>  { [ F17,                   F17, F17, F17 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK18>  { [ F18,                   F18, F18, F18 ] , type[Group1] = "FOUR_LEVEL_X" };
   key <FK19>  { [ F19,                   F19, F19, F19 ] , type[Group1] = "FOUR_LEVEL_X" };

   key <INS>   {       [ ISO_Level3_Shift,  Insert   ]       };
};

The first two key lines swap "tilde" and "section", the rest are more interesting. You see, on this keyboard (on a Mac, at least) "F1" … "F18" are reached in combination with the "fn" key, and the primary function of those keys is to be shortcuts for programs (like Exposé or Dashboard) or commands (change screen brightness, playing track, volume). So I made it work the same on X11. The FOUR_LEVEL_X type defines a key that has 4 possible symbols: on its own, with LevelThree, with Shift+LevelThree, and with Control+Alt; since I map the "ins" (really, "fn") key to ISO_Level3_Shift, I can access the function keys in combination with "fn", I can access the command keys on their own, and (quite important) I can still switch to the text consoles :-).

Oh, and Shift+Fn actually produces Shift+Insert, so I can paste from the primary selection into my terminals without reaching for the mouse.

DatesCreated: 2009-09-15 13:20:11 Last modification: 2023-02-10 12:45:24