81 votes
Accepted

On an Apple Keyboard under Linux, how do I make the Function keys work without the fn modifier key?

You need to add 0 or 2 into /sys/module/hid_apple/parameters/fnmode. i.e.: echo 2 > /sys/module/hid_apple/parameters/fnmode There seems to be some confusion regarding what the difference between ...
user avatar
  • 1,129
64 votes

List all valid kbd layouts, variants and toggle options (to use with setxkbmap)

Take a look at localectl, especially following options: localectl list-x11-keymap-layouts - gives you layouts (~100 on modern systems) localectl list-x11-keymap-variants de gives you variants for ...
user avatar
44 votes
Accepted

Gnome 3.22: disable alt+shift keyboard layout switching

Okay, got it: this line in my /etc/default/keyboard XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll" .. should not contain grp:alt_shift_toggle, which is the relevant xkb option according to this ...
user avatar
  • 2,321
38 votes

Swap alt and super

If you're wanting to do this on an Apple keyboard, try this out: echo 1|sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd To get this to work for a lower version of Linux you can try this out: ...
user avatar
  • 581
37 votes

Swap alt and super

If you only want to swap left alt and super key execute the command in your terminal: setxkbmap -option altwin:swap_alt_win To restore the default behavior just use: setxkbmap -option Note: This ...
user avatar
  • 491
33 votes
Accepted

Does Wayland use XKB for keyboard layouts?

Yes, Wayland uses XKB for keyboard layouts. But it's not quite the right question, because things work different than in X. Remember that Wayland is only a protocol (plus a wrapper library). At the ...
user avatar
  • 516
23 votes
Accepted

How to allow for caps-lock keyboard layout change

You could set the corresponding xkb option via dconf-editor. Navigate to org > gnome > desktop > input-sources and add grp:caps_toggle to your xkb-options: Note each option is enclosed in single ...
user avatar
  • 73.4k
23 votes

How to allow for caps-lock keyboard layout change

If you're looking for a way to visually edit configuration as in other answer, there's dconf-editor supplied with dconf-tools: sudo aptitude install dconf-tools If you fancy batch editing needed ...
user avatar
  • 1,278
19 votes
Accepted

How to make SysRq working on laptop?

Most laptops require pressing Fn to get the SysRq key. Pressing Fn usually doesn't affect the Alt key (at least the left one) but may affect the letter that you press after SysRq. Fortunately, you don'...
user avatar
18 votes

How to display the current keyboard layout?

From the command line: gkbd-keyboard-display -l <layout>. To see what your installed keyboards are (for example to find the layout code to use in the command above) use setxkbmap -query.
user avatar
  • 191
18 votes

How to get all my keys to send keycodes

Don't use showkey or xev -- use udev and evtest instead. Look at the output of evtest # evtest No device specified, trying to scan all of /dev/input/event* Available devices: /dev/input/event0: ...
user avatar
18 votes
Accepted

Override a few keycodes with XKB

Create a file containing your keycode changes, and save it as (for example) ~/.xkb/keycodes/local. (The keycodes directory is hard-coded; the base directory can be something else, and the filename too....
user avatar
17 votes

How to change keyboard layout in gnome 3 from command line

Since gnome-shell exposes a JS eval interface on DBus which has access to all variables, the feat is possible with the following command: gdbus call --session --dest org.gnome.Shell \ --object-path /...
user avatar
  • 1,278
17 votes
Accepted

Changing the keyboard layout/mapping on both the console (tty) and X in an X/console agnostic way?

Yes, there is a way, and this is indeed how Debian's console-setup package does it. Keyboard layouts are specified in XKB terms (model, layout, variant, and options) by the administrator in a file ...
user avatar
  • 62.4k
16 votes

How to create lowercase pi (“π”) with compose key?

as others remark, there are no standard compose rules in X for π, so if you want to use compose to make the π symbol (as I just did), you could: install uim create ~/.XCompose put there the rules you ...
user avatar
  • 2,570
15 votes
Accepted

Grub2 without arrow keys

Grub uses Emacs-like key bindings: Ctrl+B = Left, Ctrl+F = Right (mnemonic: backward/forward) Ctrl+P = Up, Ctrl+N = Down (mnemonic: up/down) Ctrl+A = Home, Ctrl+E = End (mnemonic: A=beginning/end) ...
user avatar
14 votes

List all valid kbd layouts, variants and toggle options (to use with setxkbmap)

You could retrieve the list in that file /usr/share/X11/xkb/rules/evdev.lst Example to retrieve variants with sed to find only Danish variant sed '/! variant/,/^$/!d;/Danish/!d' < /usr/share/X11/...
user avatar
  • 261
13 votes
Accepted

Remapping both Caps Lock and Shift+Caps Lock in xkb

This seems to accomplish what you're looking for. partial modifier_keys xkb_symbols "compose" { key <CAPS> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Multi_key, ...
user avatar
  • 493
13 votes
Accepted

Remapping Caps Lock to Compose

X11 (classic) Run the program xev from a terminal to see the keycode sent by the CapsLock key. That's the number just after keycode on the third line from the KeyPress event line corresponding to ...
user avatar
12 votes
Accepted

setxkbmap: Multiple layouts with different variants

As per xorg docs and archwiki: You must specify as many variants as the number of specified layouts. If you want the default variant, specify an empty string as the variant (the comma must stay)...
user avatar
  • 73.4k
11 votes
Accepted

xkb: make ctrl+backspace behave as delete

As Gilles pointed out in a comment, you can do it with xkb if you change the type of BKSP key to control-modifiable. Example: if I edit /usr/share/X11/xkb/symbols/pc and under: include "pc(...
user avatar
  • 73.4k
11 votes
Accepted

How to list all currently available compose key combinations?

Not exactly. If you are talking about X alone, you can look at the compose tables. However, some people want to know this about GNOME without making a distinction. The Gtk Compose Table started off ...
user avatar
11 votes
Accepted

What files does the Gnome Tweak Tool act on (when changing the Typing settings)?

The files altered by gnome-tweak-tool are ~/.config/dconf/user (this is the dconf database, a binary file where most user settings are stored) and various other configuration files under ~/.config (...
user avatar
  • 73.4k
10 votes
Accepted

Tuning keyboard (dead key) functionality in X

The dead key sequences are configured in the same place as the compose key sequences, in the compose map. The compose map file is loaded by each application when it starts up; the following files are ...
user avatar
10 votes
Accepted

xmodmap shift + keycode to produce keysym

Key chords (like Shift+\) are specified by combining one key with a set of modifiers, not by combining keys directly. So rather than “keycode 50 plus keycode 21”, what you need to specify is “keycode ...
user avatar
10 votes
Accepted

How to remap keyboard keys based on how long you hold the key

I just wrote this in C: #include <stdio.h> #include <curses.h> #include <time.h> //time(0) #include <sys/time.h> // gettimeofday() #include <stdlib.h> ...
user avatar
  • 4,468
10 votes
Accepted

How can one create a custom keyboard layout for Linux?

You can edit keymaps with XKeyCaps. On the upside, XKeyCaps is a GUI and it's very mature. A downside of XKeyCaps is that it's only a front-end to the old-style X window keymap interface, xmodmap, and ...
user avatar
10 votes
Accepted

What does "level" of a key mean in keyboard settings?

Level 1: no modifications (e.g. pure a) Level 2: usually Shift (e.g. shift+a -> A, so the character A is level 2 of the a-key) Level 3: usually AltGr (e.g. AltGr+a -> æ, so character æ is level ...
user avatar
  • 10.8k
9 votes

How to display the current keyboard layout?

Selecting the current layout with gkbd-keyboard-display is possible like so: #! /usr/bin/env fish set layout (setxkbmap -query | grep layout | tr -s ' ' | cut -d ' ' -f2) set variant (setxkbmap -...
user avatar
  • 1,915
9 votes
Accepted

Remap keyboard on the Linux console

Linux uses two independent keyboard mappings. One for the graphical mode X and one for the console. You usually change the first one with setxkbmap (or xmodmap) and the second one with loadkeys. All ...
user avatar
  • 20.1k

Only top scored, non community-wiki answers of a minimum length are eligible