N900 keyboard remapping

 

My N900 has an AZERTY keyboard. Yours probably has a QWERTY one. Anyway, both only have 38 keys. This implies that some characters or shortcuts are missing or are only available via additional combinations of keys.

This section discusses how the keyboard can be remapped in order to configure additional combinations of keys. Even if you do not have an AZERTY keyboard, the process may be of interest for your version.

Note that I do not discuss here how keyboard changes can be done using Xmodmap.

The file to modify is /usr/share/xkb/symbols/nokia_vndr/rx-51. The most important part of the file (for a french mapping) are provided below. Then, modified lines are given.

default partial alphanumeric_keys
xkb_symbols "common" {
    include "nokia_vndr/rx-51(common_keys)"
    include "nokia_vndr/rx-51(modifiers)"
};

partial alphanumeric_keys
xkb_symbols "fr" {
    include "nokia_vndr/rx-51(english_base)"
    include "nokia_vndr/rx-51(arrows_2btns)"

    name[Group1] = "French";

    // 1. row
    key <AD01>	{ [	a,		A,		1,		1		] };
    key <AD02>	{ [	z,		Z,		2,		2		] };
    key <AB08>	{ [	agrave,		Agrave,		ccedilla,	Ccedilla	] };

    // 2. row
    key <AC01>	{ [	q,		Q,		asterisk,	asterisk	] };
    key <AC02>	{ [	s,		S,		plus,		plus		] };
    key <AC03>	{ [	d,		D,		numbersign,	numbersign	] };
    key <AC04>	{ [	f,		F,		minus,  	minus		] };
    key <AC05>	{ [	g,		G,		underscore,	underscore	] };
    key <AC06>	{ [	h,		H,		exclam,		exclam		] };
    key <AC07>	{ [	j,		J,		question,	question	] };
    key <AC08>	{ [	k,		K,		colon,		colon		] };
    key <AC09>	{ [	l,		L,		dead_circumflex,dead_circumflex	] };
    key <AB09>	{ [	m,		M,		ugrave,		Ugrave		] };
    key <UP>	{ [	eacute,		Eacute,		egrave,		Egrave		] };

    // 3. row
    key <AB01>	{ [	w,		W,		EuroSign,       EuroSign	] };
    key <AB03>	{ [	c,		C,		parenleft,	parenleft	] };
    key <AB04>	{ [	v,		V,		parenright,	parenright	] };
    key <AB05>	{ [	b,		B,		slash,		slash		] };
    key <AB07>	{ [	comma,		comma,		apostrophe,	apostrophe	] };
    key <LEFT>	{ [	semicolon,	period,		period,		period		] };
};

partial hidden alphanumeric_keys
xkb_symbols "english_base" {

    // 1. row
    key <AD01>	{ [	q,		Q,		1,		1		] };
    key <AD02>	{ [	w,		W,		2,		2		] };
    key <AD03>	{ [	e,		E,		3,		3		] };
    key <AD04>	{ [	r,		R,		4,		4		] };
    key <AD05>	{ [	t,		T,		5,		5		] };
    key <AD06>	{ [	y,		Y,		6,		6		] };
    key <AD07>	{ [	u,		U,		7,		7		] };
    key <AD08>	{ [	i,		I,		8,		8		] };
    key <AD09>	{ [	o,		O,		9,		9		] };
    key <AD10>	{ [	p,		P,		0,		0		] };
    key <AB08>	{ [	comma,		semicolon,	equal,		equal		] };

    // 2. row
    key <AC01>	{ [	a,		A,		asterisk,	asterisk	] };
    key <AC02>	{ [	s,		S,		plus,		plus		] };
    key <AC03>	{ [	d,		D,		numbersign,	numbersign	] };
    key <AC04>	{ [	f,		F,		minus,		minus		] };
    key <AC05>	{ [	g,		G,		underscore,	underscore	] };
    key <AC06>	{ [	h,		H,		parenleft,	parenleft	] };
    key <AC07>	{ [	j,		J,		parenright,	parenright	] };
    key <AC08>	{ [	k,		K,		ampersand,	ampersand	] };
    key <AC09>	{ [	l,		L,		exclam,		exclam		] };
    key <AB09>	{ [	period,		colon,		question,	question	] };

    // 3. row
    key <AB01>	{ [	z,		Z,		sterling,	sterling	] };
    key <AB02>	{ [	x,		X,		dollar,		dollar		] };
    key <AB03>	{ [	c,		C,		EuroSign,	EuroSign	] };
    key <AB04>	{ [	v,		V,		slash,		slash		] };
    key <AB05>	{ [	b,		B,		backslash,	backslash	] };
    key <AB06>	{ [	n,		N,		quotedbl,	quotedbl	] };
    key <AB07>	{ [	m,		M,		apostrophe,	apostrophe	] };
    key <SPCE>	{ [	space,		space,		at,		at		] };
};

partial hidden alphanumeric_keys
xkb_symbols "common_keys" {
    // all other common keys

    key <BKSP>	{ [	BackSpace	] };
    key <TAB>	{ [	Tab		] };

    // broken UI spec.
    key <RTRN>	{ [	KP_Enter	] };

    key <KPEN>	{ [	Return		] };
    key <ESC>	{ [	Escape		] };

    key <FK01>	{ [	F1	] };
    key <FK02>	{ [	F2	] };
    key <FK03>	{ [	F3	] };
    key <FK04>	{ [	F4	] };
    key <FK05>	{ [	F5	] };
    key <FK06>	{ [	F6	] };

    // Swap +/- keys intentionally. The VOL+/VOL- keys are located physically
    // on left/right and up/down in landscape/portrait orientation. This does
    // not feel natural for the user and therefore we want the VOL+/VOL- keys
    // map to -/+.
    //
    // The only exception is an active call in portrait mode where we want to
    // use the real meanings of the keys. This special case and management of
    // +/- keys in general is handled in maemo-statusmenu-volume.
    key <FK07>	{ [	F8	] };
    key <FK08>	{ [	F7	] };

    key <FK09>	{ [	F9	] };
    key <FK10>	{ [	F10	] };
    key <FK11>	{ [	F11	] };
};

partial hidden alphanumeric_keys modifier_keys
xkb_symbols "modifiers" {
    // Shift switches between current level and level+1
    key <LFSH>	{
	type[Group1] = "ONE_LEVEL",
	symbols[Group1] = [	Shift_L	]
    };
    modifier_map Shift { Shift_L };

    // Fn+Ctrl virtual symbol table (Multi_key)
    // Ctrl+Space switches between 1st and 5th level (hardcoded in hildon)
    key <LCTL>	{
	type[Group1] = "FOUR_LEVEL",
	symbols[Group1] = [	Control_L,	Control_L,	Multi_key,	Multi_key	]
    };
    modifier_map Control { Control_L };

    // Fn key (right alt) switches to 3rd level
    include "level3(ralt_switch)"
};

partial hidden alphanumeric_keys
xkb_symbols "arrows_2btns" {
    // rx-51 specific arrows mapping
    // normal 2nd level must not be enumerated to allow text selection with Shift key
    key <DOWN>	{ type[Group1] = "PC_FN_LEVEL2", symbols[Group1] = [	Left,	Up	] };
    key <RGHT>	{ type[Group1] = "PC_FN_LEVEL2", symbols[Group1] = [	Right,	Down	] };
};

partial hidden alphanumeric_keys
xkb_symbols "arrows_4btns" {
    // standard arrows mapping
    // normal 2nd level must not be enumerated to allow text selection with Shift key
    key <UP>	{ type[Group1] = "ONE_LEVEL", symbols[Group1] = [	Up	] };
    key <LEFT>	{ type[Group1] = "ONE_LEVEL", symbols[Group1] = [	Left	] };
    key <DOWN>	{ type[Group1] = "ONE_LEVEL", symbols[Group1] = [	Down	] };
    key <RGHT>	{ type[Group1] = "ONE_LEVEL", symbols[Group1] = [	Right	] };
};

So, now that you have the context, here are the things that are missing for me and how I want to access them:

You might initially think that the "shift + blue arrow + key" combination is difficult to use. In fact, it quickly becomes pretty natural.

Anyway, here are the changes required to configure previous key combinations.

Below are the changes for <, >, [, ], &:

    key <AD06>  { [     y,              Y,              6,              less            ] };
    key <AD07>  { [     u,              U,              7,              greater         ] };
    key <AD08>  { [     i,              I,              8,              bracketleft     ] };
    key <AD09>  { [     o,              O,              9,              bracketright    ] };
    key <AD10>  { [     p,              P,              0,              ampersand       ] };

For |:

    key <AC09>  { [     l,              L,     dead_circumflex,         bar             ] };

For {, }, \, escape and F6:

    key <AB03>  { [     c,              C,              parenleft,      braceleft       ] };
    key <AB04>  { [     v,              V,              parenright,     braceright      ] };
    key <AB05>  { [     b,              B,              slash,          backslash       ] };
    key <AB07>  { [     comma,          Escape,         apostrophe,     apostrophe      ] };
    key <LEFT>  { [     semicolon,      period,         period,         F6              ] };

For tabulation:

    key <BKSP>  { [     BackSpace,      Tab,            BackSpace,      BackSpace       ] };

Well, in the end, I find it more readable as an unified diff:

--- rx-51.orig  2009-12-02 22:45:55.000000000 +0100
+++ rx-51       2009-12-14 22:08:51.000000000 +0100
@@ -155,6 +155,11 @@
     // 1. row
     key <AD01> { [     a,              A,              1,              1               ] };
     key <AD02> { [     z,              Z,              2,              2               ] };
+    key <AD06> { [     y,              Y,              6,              less            ] };
+    key <AD07> { [     u,              U,              7,              greater         ] };
+    key <AD08> { [     i,              I,              8,              bracketleft     ] };
+    key <AD09> { [     o,              O,              9,              bracketright    ] };
+    key <AD10> { [     p,              P,              0,              ampersand       ] };
     key <AB08> { [     agrave,         Agrave,         ccedilla,       Ccedilla        ] };
 
     // 2. row
@@ -166,17 +171,17 @@
     key <AC06> { [     h,              H,              exclam,         exclam          ] };
     key <AC07> { [     j,              J,              question,       question        ] };
     key <AC08> { [     k,              K,              colon,          colon           ] };
-    key <AC09> { [     l,              L,              dead_circumflex,dead_circumflex ] };
+    key <AC09> { [     l,              L,              dead_circumflex,bar             ] };
     key <AB09> { [     m,              M,              ugrave,         Ugrave          ] };
     key <UP>   { [     eacute,         Eacute,         egrave,         Egrave          ] };
 
     // 3. row
     key <AB01> { [     w,              W,              EuroSign,       EuroSign        ] };
-    key <AB03> { [     c,              C,              parenleft,      parenleft       ] };
-    key <AB04> { [     v,              V,              parenright,     parenright      ] };
-    key <AB05> { [     b,              B,              slash,          slash           ] };
-    key <AB07> { [     comma,          comma,          apostrophe,     apostrophe      ] };
-    key <LEFT> { [     semicolon,      period,         period,         period          ] };
+    key <AB03> { [     c,              C,              parenleft,      braceleft       ] };
+    key <AB04> { [     v,              V,              parenright,     braceright      ] };
+    key <AB05> { [     b,              B,              slash,          backslash       ] };
+    key <AB07> { [     comma,          Escape,         apostrophe,     apostrophe      ] };
+    key <LEFT> { [     semicolon,      period,         period,         F6              ] };
 };
 
 
@@ -390,7 +395,7 @@
 xkb_symbols "common_keys" {
     // all other common keys
 
-    key <BKSP> { [     BackSpace       ] };
+    key <BKSP> { [     BackSpace,      Tab,            BackSpace,      BackSpace       ] };
     key <TAB>  { [     Tab             ] };
 
     // broken UI spec.

If you have a french N900 (with an AZERTY keyboard), then you might be interested in the complete modified version of my rx-51 file.