X11 Keyboard Tips
Default keyboard layout
On Debian based systems, you can modify the configuration stored in /etc/default/keyboard by reconfiguring the keyboard-configuration package e.g.:
$ sudo dpkg-reconfigure keyboard-configuration
$ sudo service keyboard-setup restart
See also https://wiki.debian.org/Keyboard
Keyboard layout
Use setxkbmap to change the layout during a session. setxkbmap can be
used to change the settings on the fly. Look at the contents of
/etc/default/keyboard to see the current values. See
man setxkbmap for help. E.g. The following command sets the
layout to ‘gb’ (United Kingdom :-0 ) with the ‘intl’ variant and setting
options of using the ‘menu’ key as the compose key and allowing
ctrl-alt-backspace to restart X.
$ setxkbmap gb intl compose:menu,terminate:ctrl_alt_bksp
Another option is to use a key combination to switch between two keyboard configurations. E.g. ‘us(mac)’ and ‘gb(mac)’ using the shift and alt-right key combination to toggle between the two:
$ setxkbmap -model apple -layout 'gb(mac),us(mac)' \
-option 'grp:alt_shift_toggle'
$ setxkbmap -print -verbose 10
The various layouts are stored in files under /usr/share/X11/xkb/symbols e.g. the above layout is described in /usr/share/X11/xkb/symbols/gb
Each key is described as an array of normal state, shifted state,
AltGr state and shifted AltGr state. The xkb_symbols “intl” section
describes the variants. Note that the gb intl variant
provides no method for creating the tilde symbol (asciitilde), so you
may prefer not to use the intl variant (with dead keys) and use ComposeKeys with the normal gb layout to
produce accented characters etc.
Install the xvkbd package to use a virtual keyboard to
support characters you cannot otherwise access with a hardware
keyboard.
Note The xfce4-xkb-plugin available in
Debian for xfce4 provides a panel
item allowing switching between keyboard layouts.
However, keyboard switching does not work on LXDE 13.0 when set in
~/.config/lxsession/LXDE/autostart. The first keyboard is
set properly, but the group switching combination is ignored. You will
need to repeat the command from the CLI to enable keyboard switching.
Similarly XFCE4 4.20.1 does not set keyboard switching set in
~/.config/xfce4/xfconf/xfce-perchannel-xml/keyboard-layout.xml,
nor the correct keyboard geometry unless updated after login. Clicking
on the panel item from the xfce4-xkb-plugin does switch the
keyboards but doesn’t fully effect the layout in the same way as running
setxkbmap.
Mouse Pointer
Enable using the numeric keypad as a mouse pointer by pressing Ctrl-Shift-NumLock. Thereafter the mouse pointer can be used by using the arrow keys on the numeric keypad. The ‘5’ key performs a left mouse button click.
References
- https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
- https://www.xfree86.org/current/XKB-Config2.html
- http://en.wikipedia.org/wiki/Keyboard_layout
- https://wiki.debian.org/Keyboard
- https://manpages.debian.org/trixie/xkb-data/xkeyboard-config.7.en.html
- How to identify your Apple keyboard layout by country or region - Apple Support
Related Topics: ComposeKeys, GnomeTips