Skip to main content
19 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 ...
Gilles 'SO- stop being evil''s user avatar
9 votes
Accepted

How to make xmodmap changes permanent?

Reboot On the setting panel (KDE/GNOME) there is a startup section where application can be added to startup session, xmodmap can be added there Resume Xmodmap does not keep the changes after sleep/...
intika's user avatar
  • 15.1k
8 votes

xmodmap hanging the system for 20 secs and not sticking

I had this problem with the xmodmap command to freeze the system for ~20 seconds. It appeared that I had the whole keymap in my .Xmodmap file, which forced xmodmap to remap every row in the config ...
kontrollanten's user avatar
8 votes
Accepted

Advanced key mappings in linux

I confirmed all of the following on a ThinkPad P1 running Pop!_OS (a derivative of Ubuntu 18.10) in GNOME. Finding Key Codes Run xev in a terminal and start typing. There's a lot of data, but what ...
shender's user avatar
  • 196
7 votes

F1-F12 keys don't work

I found solution here: https://forums.gentoo.org/viewtopic-t-1063898-start-0.html change behaviour on the fly # echo 2 > /sys/module/hid_apple/parameters/fnmode or modify it in config [/etc/...
Максим Данилов's user avatar
6 votes

What is the Mode_switch modifier for?

Mode_shift in Xkb is a shift key for groups or layouts. If you have a layout with multiple groups, you can hold down this key to access the next group. If you have several layouts, you can hold down ...
Guildenstern's user avatar
6 votes

xmodmap key bindings reset when I open a new tab in the shell

Don't run xmodmap in .bashrc. It belongs in ~/.xinitrc so your window manager will run it once upon startup. The same keybindings will continue to be available when you open your 2nd or 3rd shell tab....
J_H's user avatar
  • 971
6 votes
Accepted

xmodmap resets when keyboard mode changes

Unfortunately, in Linux Mint (and Ubuntu derivates) xmodmap resets whenever a keyboard is plugged/unplugged or when a new keyboard is detected. In the case of keyboards with dual mode like mine, the ...
gilbertohasnofb's user avatar
5 votes

How to permanently remap caps lock to esc in X11?

EDIT: As a helpful user has pointed out, my initial solution will not survive an update. His solution in the comments should work. If you prefer to swap Caps Lock and Escape instead, I would recommend ...
yashlala's user avatar
5 votes

Switch Fn key state

For Logitec wireless keyboards, namely my K400+, you can install Solaar from here. It has an option to switch Fn keys to behave like normal F keys by default, just beware that the packaged versions (e....
Doobd's user avatar
  • 51
5 votes
Accepted

How to install xev if it is not present

Using the command apt-cache search '\<xev\>', you find that it's in the x11-utils package.
5 votes
Accepted

How to activate a deactivated num_lock?

You need to set the key back to Num_Lock: xmodmap -e "keycode 77 = Num_Lock"
Vojtech Trefny's user avatar
4 votes

Why doesn't this udev rule trigger upon removal of the device?

It's been a few years since the previous answer was written. It appears that since then udev has changed so that the udev solution no longer works, at least for Ubuntu 18.04 with udev package version ...
echo's user avatar
  • 141
4 votes

xfce swap command and control keys

setxkbmap -option altwin:left_meta_win Run echo -option altwin:left_meta_win >> ~/.Xkbmap to make it permanent.
Igor Yurinok's user avatar
4 votes
Accepted

How to map mouse keys as keyboard keys without losing'numeric keypad' for Linux?

W00T ! First : create a script click: #!/bin/bash id=$( xinput list | awk '/Dell USB Keyboard/{print gensub(/.*id=([0-9]+).*/, "\\1", "1")}' ) xdotool mousedown $1 while IFS= read -r ...
Mévatlavé Kraspek's user avatar
4 votes

xmodmap lost after sleep

Your modified settings are also "lost" when you unplug and replug the keyboard, and this is what is happening here: the suspend generates hotplug events as the keyboard is disabled when ...
Simon Richter's user avatar
4 votes

Remapping Caps Lock to Alt (Meta) in GNOME / X11

After looking at https://unix.stackexchange.com/a/195160/222974, I found out that adding clear Lock to the xmodmap command makes it work. I then put these two commands in a (new) file at ~/.Xmodmap: ...
yerforkferchips's user avatar
4 votes
Accepted

Xmodmap: Remapped Home key works, but not Shift+Home

The first entry indicates to what the keycode will be mapped when no modifier is pressed. The second entry will be triggered when the key is pressed with the shift modifier (read more in this ArchWiki ...
Quasímodo's user avatar
  • 19.4k
4 votes

xev doesn't identify some keys, and some have incorrect mappings?

The FocusIn and FocusOut events mean some other application is reacting to the keypress. Usual suspects are your Window Manager ("WM", often part of "the Desktop") and other ...
dirkt's user avatar
  • 33.4k
4 votes
Accepted

How to remap a regular key into a modifier key (Shift...) in Linux

You can remap scancodes to keycodes with udev, this works whether you are using xorg, wayland or the virtual console. The scan code can be obtained with the evtest command. Select your keyboard when ...
memchr's user avatar
  • 711
3 votes

xfce swap command and control keys

If you try running man xkeyboard-config, you'll get tons of options for switching behaviors. My favorite is ctrl:swap_rwin_rctl, which makes (only) the right Command (a.k.a. Meta, Super, Win) work as ...
Waldir Leoncio's user avatar
3 votes

xmodmap lost after sleep

Remember to replace $USER with your actual username: Generate your .Xmodmap file with the mapping, in my case it is: keycode 96 = XF86AudioLowerVolume keycode 95 = XF86AudioMute keycode 76 = ...
Daniel Jąszczyszczykołęczewski's user avatar
3 votes
Accepted

How to swap Left Alt with Right Alt

In man xkeyboard-config, Key to choose the 3rd level, several options are listed to modify access to the 3rd level. lv3:alt_switch Any Alt lv3:lalt_switch Left Alt lv3:...
Quasímodo's user avatar
  • 19.4k
3 votes
Accepted

How to use setxkbmap to map keys permanently?

I don't have enough reputation to leave a comment. The following AskUbuntu question has an accepted answer (that references xmodmap) and other answers which have some good feedback, which may answer ...
Aubs's user avatar
  • 221
2 votes

xfce swap command and control keys

I'm just starting over since the original response was too long and detailed. I'd simply use xkeysnail, it is like xmodmap, or xkb, but more configurable, python based, easier to modify and it is ...
R Ben R's user avatar
  • 181
2 votes

Altering keyboard layout on plugging in or out

Inspired by this blog article I got xmodmap to work with the following rule in /etc/udev/rules.d/70-usb-keyboards.rules: ACTION=="add", ATTRS{idVendor}=="0000", ATTRS{idProduct}==&...
dessert's user avatar
  • 1,735
2 votes
Accepted

how to remap super keys?

Trying to understand what's happenning If I type xmodmap without argument (to get modifier list), I get: xmodmap: up to 4 keys per modifier, (keycodes in parentheses): shift Shift_L (0x32), ...
ewen-goisot's user avatar
2 votes

Remap keys on GNOME3.8 using xmodmap?

In case someone else stumbles upon this, it is properly discussed here: https://bugzilla.redhat.com/show_bug.cgi?id=873656 Unfortunately .xmodmap is not and will not be supported by Gnome 3 anymore. ...
Stefanos Kalantzis's user avatar

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