Gentoo Archives: gentoo-user

From: Alan Mackenzie <acm@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How do I change an X keyboard layout?
Date: Thu, 22 Oct 2015 20:24:24
Message-Id: 20151022202551.GC2645@acm.fritz.box
In Reply to: [gentoo-user] How do I change an X keyboard layout? by Alan Mackenzie
1 Hello, Gentoo.
2
3 On Wed, Oct 21, 2015 at 03:51:43PM +0000, Alan Mackenzie wrote:
4 > The two keyboard layouts I use in XFCE are both fine and dandy, but they
5 > are incomplete. In particular, I want the key combination
6 > <Ctrl><Alt><shift><F1> to take me to tty13 in the same way that
7 > <Ctrl><Alt><F1> takes me to tty1.
8
9 > I've been searching for _hours_ trying to find out how to do this. I
10 > cannot find the keyboard layouts anywhere under /usr/share, where one
11 > might expect them. I can't find any relevant programs to manipulate
12 > these data files with, even if I could find them.
13
14 > Would somebody help me please. Where are the X keyboard layouts stored,
15 > and what program to I need to enhance them?
16
17 > TIA!
18
19 Well, I've nailed it, but it took me the best part of two days. The X
20 keyboard setup, called xkb, is much more complicated than that for the
21 virtual terminal, probably needlessly. I can't see what this extra
22 complexity gains.
23
24 Three files needed amending, they being under /usr/share/X11/xkb:
25
26 1: /usr/share/X11/xkb/symbols/srvr_ctrl, where the actions for the Fn
27 keys are defined. They were defined as being of type "CTRL+ALT" which
28 allowed Fn to be pressed together with any combination of <shift> and
29 <AltGr>, together with <Ctrl>-<Alt>-Fn. This involved replacing the
30 type with a new type "CTRL+ALT+SHIFT", which had to be defined in ....
31
32 2: /usr/share/X11/xkb/types/pc. The new type "CTRL+ALT+SHIFT" was easy
33 enough to clone from "CTRL+ALT", then amend.
34
35 3: /usr/share/X11/xkb/compat/xfree86. In this file, wierdly classified
36 "compatibility" (i.e. action) settings are made. Here it was necessary
37 to realise that "XF86_Switch_VT_1", etc, were, intrinsically, symbols
38 without a specific meaning. Only an entry in this file actually made
39 XF86_Switch_VT_1 do anything. Having grasped this, it was necessary to
40 use other otherwise meaningless symbols for the action "go to terminal
41 13", etc. F13, F14, ..., F24 happened to be defined, and they worked.
42
43 Phew! Thank goodness for the tutorials I managed to find online. The
44 one that was most useful was at
45 <http://www.charvolant.org/~doug/xkb/html/index.html>.
46
47 So all I've got to do now is make a patch and put it into
48 /etc/portage/patches so that I won't lose the changes at the next update
49 of xkb.
50
51 > --
52 > Alan Mackenzie (Nuremberg, Germany).

Replies

Subject Author
Re: [gentoo-user] How do I change an X keyboard layout? Peter Humphrey <peter@××××××××××××.uk>