Yellow Rabbit

Frozen

Here is an active version

How to Configure the Keyboard in Xorg

Keyboard Setup in Xorg - Acer C720 Laptop

The keyboard of the Chromebook Acer C720 is probably good for walks on the network and work in the Chrome OS, but I do not have enough keys to write the programs. These are Home, End, PageUp, PageDown, Insert and Delete.

You can try using the Alt key (generates the Alt character) as a modifier for the cursor keys. Then the following keyboard combinations are obtained:

KeyCombination
InsertAlt + \
DeleteAlt + BackSpace
HomeAlt + Left (←)
EndAlt + Right (→)
PageUpAlt + Up (↑)
PageDownAlt + Down (↓)

To modify the layout use xkb. First, create a directory for the configuration files:


	mkdir -p ${HOME}/.config/xkb/types ${HOME}/.config/xkb/symbols

In the file ${HOME}/.config/xkb/types/c720 we specify how the two modifiers will behave together - Shift and Alt. Interest is represented by situations when Alt is pressed, that is, level 3.


xkb_types "c720" {
	virtual_modifiers Alt;
	type "ARROW" {
		modifiers	= Shift+Alt;
		map[Shift]	= Level2;
		map[Alt]	= Level3;
		map[Alt+Shift]	= Level3;
		level_name[Level1] = "Base";
		level_name[Level2] = "Caps";
		level_name[Level3] = "Alt";
	};
};

In the file ${HOME}/.config/xkb/symbols/c720 at level 3, we perform a substitution of the keys for the required keys and do not forget to clear the modifier flag, otherwise the new characters will not be processed correctly.


xkb_symbols "c720" {
	key <BKSL> {
		type="ARROW",
		repeat=yes,
		symbol[Group1] = [backslash, bar, Insert],
		symbol[Group2] = [backslash, slash, Insert],
		actions[Group1] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<INS>, clearmods=Alt)
		],
		actions[Group2] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<INS>, clearmods=Alt)
		]
	};
	key <BKSP> {
		type="ARROW",
		repeat=yes,
		[BackSpace, BackSpace, Delete],
		actions[Group1] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<DELE>, clearmods=Alt)
		]
	};
	key <LEFT> {
		type="ARROW",
		[Left, Left, Home],
		actions[Group1] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<HOME>, clearmods=Alt)
		]
	};
	key <RGHT> {
		type="ARROW",
		repeat=yes,
		[Right, Right, End],
		actions[Group1] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<END>, clearmods=Alt)
		]
	};
	key <UP> {
		type="ARROW",
		repeat=yes,
		[Up, Up, Prior],
		actions[Group1] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<PGUP>, clearmods=Alt)
		]
	};
	key <DOWN> {
		type="ARROW",
		[Down, Down, Next],
		actions[Group1] = [
			NoAction(),
			NoAction(),
			RedirectKey(key=<PGDN>, clearmods=Alt)
		]
	};
};

It remains to write the following command in .xinitrc to load the changed layout:


setxkbmap -layout "us+c720" -types "complete+c720" -print|xkbcomp -I"$HOME/.config/xkb" - "${DISPLAY%%.*}"