Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
6
votes
1
answers
3635
views
How to make ISO_Level5_Shift work?
I wanted to add more levels to my keyboard layouts, so I decided to enable level5 key. I’ve already had level3 on `Menu`, and would like to map RAlt to ISO_Level5_Shift. However, `setxkbmap` has no option for that. `/usr/share/X11/xkb/rules/evdev.lst` contains only the following options in regard to...
I wanted to add more levels to my keyboard layouts, so I decided to enable level5 key. I’ve already had level3 on
Menu
, and would like to map RAlt to ISO_Level5_Shift.
However, setxkbmap
has no option for that. /usr/share/X11/xkb/rules/evdev.lst
contains only the following options in regard to lv5 switch:
lv5:lsgt_switch_lock
lv5:ralt_switch_lock
lv5:lwin_switch_lock
lv5:rwin_switch_lock
As if mapping a simple key is not possible. This already hinted on troubles.
Knowing what setxkbmap
does internally, it’s easy to construct an option to enable lv5 switch and set to right Alt
:
-option "lv5:ralt_switch"
And, despite that setxkbmap
takes this option and returns with success, there’s no mapping.
*****
After finding an answer to a similar question [here](https://askubuntu.com/a/973273) I’ve constructed a custom xkbcomp
file.
xkb_keymap {
xkb_geometry {
include "pc(pc104)"
};
xkb_keycodes {
include "evdev"
include "aliases(qwerty)"
};
xkb_types {
include "complete"
};
xkb_compatibility {
include "complete"
include "ledscroll(group_lock)"
};
xkb_symbols {
include "pc+us+ru:2+inet(evdev)"
include "group(rctrl_rshift_toggle)"
include "ctrl(swapcaps)"
include "keypad(oss)"
include "kpdl(dot)"
include "terminate(ctrl_alt_bksp)"
include "level3(modifier_mapping)"
include "level3(menu_switch)"
include "level5(modifier_mapping)"
include "level5(ralt_switch)"
key {
type= "EIGHT_LEVEL",
symbols[Group1]= [ n, N, n, n, u, i, o, p ],
symbols[Group2]= [ Cyrillic_te, Cyrillic_TE, n, n, u, i, o, p ]
};
};
};
This should assign Menu key to be ISO_Level3_Shift and RAlt to be ISO_Level5_Shift. And the keys are assigned, but there is an error:
$ xkbcomp ~/new.xkbcomp.xkb :0
Error: Key added to map for multiple modifiers
Using Mod3, ignoring Mod5.
xkbcomp
returns with code 0, despite that there was an error.
The mapping on key N
should have made levels 5 to 8 “u”, “i”, “o” and “p”, but instead RAlt sends the usual n and N on all eight levels (if levels >4 actually work).
In attempt to determine, how to solve this error, I’ve found, that `` is set in… the very rules file for “pc”.
/usr/share/X11/xkb/symbols/pc
:
xkb_symbols "pc105" {
…
// Fake keys for virtualreal modifiers mapping:
key { [ ISO_Level3_Shift ] };
key { [ Mode_switch ] };
modifier_map Mod5 { , };
…
};
And here is another weird thing: I include pc104 keyboard model, but this code refers to pc105 and shouldn’t be sourced at all. However… xkb_symbols "pc104"
is nowhere to be found. And this “symbols/pc” file is the only other file in /usr/share/X11/xkb/
that sets or modifies ` assignment to Mod* keys. The other file being “symbols/level5” file, which does it in
xkb_symbols "modifier_mapping"`.
// Ensure a mapping to a real modifier for LevelFive.
partial modifier_keys
xkb_symbols "modifier_mapping" {
replace key {
type[Group1] = "ONE_LEVEL",
symbols[Group1] = [ ISO_Level5_Shift ]
};
modifier_map Mod3 { };
};
I think, that this conflict may prevent both lv3 switch and lv5 switch to work at the same time, but I’m not sure. It’s concerning, that in [another answer](https://askubuntu.com/a/41585) , Mode_switch
key is present among Mod* keys, and after loading my new.xkbcomp.xkb
I don’t see it anywhere:
$ xmodmap -pm
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x25)
control Control_L (0x42), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 ISO_Level5_Shift (0xcb)
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c)
tijagi
(982 rep)
Aug 5, 2018, 05:17 PM
• Last activity: Jul 30, 2025, 06:02 PM
0
votes
1
answers
30
views
ISO Level 3 Shift no longer works after upgrade from OpenSuSE Leap 15.5. to 15.6. Why?
After upgrading my OpenSuSE Leap system from version 15.5 to 15.6, the ISO Level 3 (aka AltGr) function map to the right Alt key suddenly no longer works. The key itself is recognised as such, though, as tested with `xev` (irrelavant output omitted): ```javascript ╭─jacek@epica /usr/share/X11/xkb/sy...
After upgrading my OpenSuSE Leap system from version 15.5 to 15.6, the ISO Level 3 (aka AltGr) function map to the right Alt key suddenly no longer works. The key itself is recognised as such, though, as tested with
xev
(irrelavant output omitted):
╭─jacek@epica /usr/share/X11/xkb/symbols
╰─➤ xev
KeyPress event, serial 40, synthetic NO, window 0x4300001,
root 0x410, subw 0x0, time 7289615, (597,232), root:(1468,677),
state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x4300001,
root 0x410, subw 0x0, time 7289735, (597,232), root:(1468,677),
state 0x98, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: False
Testing the keyboard layout with setxkbmap
gives this result:
╭─jacek@epica /usr/share/X11/xkb/symbols
╰─➤ setxkbmap -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: de
variant: pl
options: compose:comp,terminate:ctrl_alt_bksp,lv3:ralt_switch,altwin:meta_win,grp:win_space_toggle
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwertz)
types: complete
compat: complete
symbols: pc+de(pl)+inet(evdev)+altwin(meta_win)+terminate(ctrl_alt_bksp)+level3(ralt_switch)+group(win_space_toggle)
geometry: pc(pc105)
level3(ralt_switch)
should be the correct directive to turn the right Alt switch into ISO Level 3 Shift, or am I wrong?
This is the system version:
╭─jacek@epica /usr/share/X11/xkb/symbols
╰─➤ uname -a
Linux epica 6.4.0-150600.23.53-default #1 SMP PREEMPT_DYNAMIC Wed Jun 4 05:37:40 UTC 2025 (2d991ff) x86_64 x86_64 x86_64 GNU/Linux
The keyboard itself is a Sun Type 7 (German layout).
So: Why does a system upgrade un-map AltGr?
**UPDATE:** When defining an accelerator for a utility in the KDE system settings, I found out that typing +J
resulted in Alt+ʒ
. This is **not** the expected result, which would have been just the ʒ and nothing else.
Maybe there is really a bug in the config. I ran xkbcomp :0 -
to stumble over lines like these:
modifier_map Control { };
modifier_map Shift { };
modifier_map Shift { };
modifier_map Mod1 { };
modifier_map Lock { };
modifier_map Mod2 { };
modifier_map Mod5 { };
modifier_map Control { };
modifier_map Mod1 { };
modifier_map Mod4 { };
modifier_map Mod4 { };
modifier_map Mod3 { };
modifier_map Mod1 { };
modifier_map Mod4 { };
modifier_map Mod4 { };
modifier_map Mod4 { };
Why is both `, and
(= the key labeled
AltGr) tied to
Mod1? Isn't
AltGr synonymous to
Mod3`??
Neppomuk
(364 rep)
Jul 16, 2025, 09:11 PM
• Last activity: Jul 25, 2025, 09:45 PM
7
votes
2
answers
3387
views
setxkbmap switches between 2 out of 3 layouts
Issuing that command: setxkbmap -layout "us,ua,ru" -variant ",winkeys" -option "grp:shift_caps_toggle,grp_led:scroll" -model pc105 -rules xorg When hitting Caps Lock + Shift I'm switching between English (us) and Ukrainian (ua) layouts, but not Russian (ru). I've tried to reset it with the following...
Issuing that command:
setxkbmap -layout "us,ua,ru" -variant ",winkeys" -option "grp:shift_caps_toggle,grp_led:scroll" -model pc105 -rules xorg
When hitting Caps Lock+Shift I'm switching between English (us) and Ukrainian (ua) layouts, but not Russian (ru).
I've tried to reset it with the following command:
setxkbmap -layout "us,ua,ru" -option ""
and played with many different options - nothing helps.
My system is Gentoo Linux and window manager wmii.
archer
(171 rep)
Jan 31, 2013, 06:11 PM
• Last activity: Jul 22, 2025, 07:05 PM
43
votes
11
answers
42591
views
How to display the current keyboard layout?
Is there a utility that allows to graphically display the current keyboard layout? This can be useful, for example, when writing in a foreign language and having the physical keyboard only indicating the local language (positioning of symbols, etc.). I would like to get a display similar to the foll...
Is there a utility that allows to graphically display the current keyboard layout?
This can be useful, for example, when writing in a foreign language and having the physical keyboard only indicating the local language (positioning of symbols, etc.). I would like to get a display similar to the following:

landroni
(11586 rep)
Jan 30, 2014, 09:15 AM
• Last activity: Jul 20, 2025, 12:08 PM
2
votes
1
answers
2585
views
How to create a new keyboard layout in the /usr/share/X11/xkb directory in Ubuntu?
In the ```/usr/share/X11/xkb/symbols``` directory there are various keyboard layouts listed. I made a copy of the ```/usr/share/X11/xkb/symbols/us``` file under the name ```/usr/share/X11/xkb/symbols/new_test_layout```. The symbols corresponding to the keys being pressed are indicated in the file as...
In the
/usr/share/X11/xkb/symbols
directory there are various keyboard layouts listed. I made a copy of the /usr/share/X11/xkb/symbols/us
file under the name /usr/share/X11/xkb/symbols/new_test_layout
.
The symbols corresponding to the keys being pressed are indicated in the file as in the given example:
xkb_symbols "basic"{
//other keys
key {[q, Q]};
//other keys
};
This means that the symbol lowercase q appears when the key AD01 is pressed normally, and uppercase Q appears when the key AD01 is pressed along with shift key. From my understanding, the third symbol listed will appear when the key is pressed along with alt-gr key, and the fourth symbol when it is pressed along with alt-gr and shift both.
I can replace the symbols provided under each key with a symbol of my choice. However, in this file the symbols are not being directly represented as string characters or by their Unicode values. For example in the file there is
key {[slash, question]};
I am very new to Linux, so I am not sure what these are, but I am guessing that they are variables defined in another file. Anyhow
will correspond to the symbol /
and
will correspond to the symbol ?
In this webpage, there is an example of an
layout for a Farsi keyboard.
https://itectec.com/ubuntu/ubuntu-how-to-add-a-new-keyboard-layout-custom-keyboard-layout-definition/
Here you can see for example,
{[Arabic_hah, bracketleft, 0x100202c]};
So the key AD10 (which is the P key in a regular QWERTY keyboard) should give the character ه which is listed as U0647 (ARABIC LETTER HEH) under Unicode. The letter is being referred to as
. Where do I find a listing of these names? If I were to simply use U0647 in its place, would it still be recognised in any file within the
directory? In Urdu there is a letter *choti he*, ہ that looks similar to the Arabic heh, but has a different Unicode listing: U06C1 (ARABIC LETTER HEH GOAL). I do not know the name that is being used for *choti he* in Linux because I cannot find the Urdu keyboard layout anywhere in the /usr/share/X11/xkb/symbols
directory, even though the files for Dari (
) and Arabic (
) are present.
Will it be sufficient if I were to simply use the Unicode values for all symbols that are supported by Linux in any file within the
directory?
sriganesh
(111 rep)
Sep 25, 2021, 12:36 PM
• Last activity: Jul 19, 2025, 06:03 AM
20
votes
9
answers
30198
views
Map Caps Lock to Control in Linux Mint
I am running the latest version of Linux Mint with Cinnamon. I'm trying to map Caps Lock to Ctrl , but I cannot figure out how to do it. All web searches I've done have led me to older versions of Linux Mint (there is no keyboard layout option in my settings). How can I do this?
I am running the latest version of Linux Mint with Cinnamon. I'm trying to map Caps Lock to Ctrl, but I cannot figure out how to do it. All web searches I've done have led me to older versions of Linux Mint (there is no keyboard layout option in my settings). How can I do this?
Zach Russell
(1127 rep)
Feb 7, 2014, 11:59 AM
• Last activity: Jul 11, 2025, 07:02 PM
43
votes
8
answers
36426
views
Swap alt and super
I have a Macbook Air that runs Linux. I want to swap the `alt` and `super` keys in both sides of the keyboard with each other. How do I do this with cli tools? **Update** Following Drav Sloan's answer I used the following: keycode 64 = Alt_L keycode 133 = Super_L remove Mod1 = Alt_L remove Mod4 = Su...
I have a Macbook Air that runs Linux. I want to swap the
alt
and super
keys in both sides of the keyboard with each other.
How do I do this with cli tools?
**Update**
Following Drav Sloan's answer I used the following:
keycode 64 = Alt_L
keycode 133 = Super_L
remove Mod1 = Alt_L
remove Mod4 = Super_L
add Mod1 = Super_L
add Mod4 = Alt_L
keycode 108 = Alt_R
keycode 134 = Super_R
remove Mod1 = Alt_R
remove Mod4 = Super_R
add Mod1 = Super_R
add Mod4 = Alt_R
user24483
Aug 15, 2013, 09:35 PM
• Last activity: Jul 11, 2025, 04:04 AM
5
votes
1
answers
2750
views
Xfce Keyboard Layout change Ctrl+Space
I've been googling this for almost a week to no avail.  When I open the Keyboard settings pane, the options (ones that have "Space" in them) are limited to only Alt + Space and Super + Space – there is no Ctrl + Space . I've found a couple of answers, none of which seem to work. The first one i...
I've been googling this for almost a week to no avail.
When I open the Keyboard settings pane, the options
(ones that have "Space" in them) are limited to
only Alt+Space
and Super+Space –
there is no Ctrl+Space.
I've found a couple of answers, none of which seem to work.
The first one is to install the xfce4-xkb-plugin (which I already had
installed), then set "use system default" flag in the Keyboard settings pane, after which use plugin Properties to set the languages and shortcuts.
It doesn't work – the Properties pane has only options
on how the pane item looks...that's it.
Number two is this line:
-option grp:ctrl_space_toggle,grp_led:scroll en,ru
It doesn't work either.
If I put this in my
.Xmodmap
file,
there is an error and the file isn't parsed anymore.
I gave up on searching, but I really need this, as it's a long time reflex.
Please help me set Ctrl+Space
as a shortcut to change layout.
(I use Arch Linux.)
simon
(171 rep)
Jun 22, 2016, 11:40 AM
• Last activity: May 29, 2025, 04:05 AM
2
votes
2
answers
186
views
How do I effectively target a specific key-modifier combination in an XKB interpret statement?
I want to lock a certain modifier (Mod3) when pressing `Control + Caps_Lock`. ``` xkb_compatibility "mod3" { // set Control bit on Control_L interpret Control_L { action = SetMods(modifiers=Control); }; // try locking Mod3 … interpret Caps_Lock+Exactly(Control) { action = LockMods(modifiers=Mod3); }...
I want to lock a certain modifier (Mod3) when pressing
Control + Caps_Lock
.
xkb_compatibility "mod3"
{
// set Control bit on Control_L
interpret Control_L {
action = SetMods(modifiers=Control);
};
// try locking Mod3 …
interpret Caps_Lock+Exactly(Control) {
action = LockMods(modifiers=Mod3);
};
};
Using xev -event keyboard
I never saw the Mod3
bit flipped, even though the Control
bit was.
I also tried using just a regular a
instead of Caps_Lock
, which didn’t change anything.
Further, I tried using AnyOf(Control)
instead of Exactly(Control)
.
---
What am I missing?
Could anything else in my XKB map interfere with the above attempt?
Or is my assumption about how the interpret
statement works just wrong?
smeikx
(83 rep)
Jun 1, 2020, 02:38 PM
• Last activity: May 21, 2025, 05:22 PM
1
votes
1
answers
71
views
Conditionally remove shift xkb modifier
I have successfully created a xkb configuration for a custom keyboard layout. However, one thing I cannot achieve is set up another key with “Home” behavior. I’d like that other key to work like the original “HOME” key, including when Shift is pressed together with Home (select everything between cu...
I have successfully created a xkb configuration for a custom keyboard layout. However, one thing I cannot achieve is set up another key with “Home” behavior. I’d like that other key to work like the original “HOME” key, including when Shift is pressed together with Home (select everything between current and start).
Here is an extract from one of my attempts.
default partial alphanumeric_keys modifier_keys
xkb_symbols "myconfig" {
name[Group1]= "namegroup";
include "latin"
key { [ Home, Home, NoSymbol, NoSymbol ] };
};
Pressing the key alone makes it act as a Home key, as desired, but pressing it together with Shift makes it act as if I was just pressing the Home key without Shift (so it does not select anything).
Indeed, when using
xkbcli interactive-wayland
, I can see how this new key I am configuring differs from the original HOME key. Pressing Shift together with the original HOME key yields seat0: keysyms [ Home ] unicode [ ] layout [ namegroup (0) ] level [ 0 ] mods [ Shift ] leds [ ]
while pressing Shift together with the new key (“AB09”) yields seat0: keysyms [ Home ] unicode [ ] layout [ namegroup (0) ] level [ 1 ] mods [ -Shift ] leds [ ]
. This, I suppose, shows that the Shift modifier is removed before reaching the application, which thus has no chance to act according to my holding Shift. By contrast, note that pressing Shift together with a letter (under a default xkb layout such as “fr”) does remove the Shift modifier, as expected, so there seems to be by default a special treatment for keys such as HOME in xkb. I ignore where and how this is specified.
I have seen some posts about the “preserve” keyword or the redirect actions, but this seems to pre-date Wayland.
Does anyone know how to make AB09
behave as the (default behavior of the) HOME
key?
Alternatively, does anyone know where the behavior of the original HOME key is configured? I cannot find any place under the usual xkb configuration files directory (/usr/share/X11/xkb/
) that indicates special treatment of this key (or the arrow keys which behave similarly), by comparison to any other key such as the letter keys. Copying such special configuration would probably solve my problem.
Olivier Cailloux
(222 rep)
Oct 12, 2024, 03:45 PM
• Last activity: May 20, 2025, 10:48 PM
1
votes
1
answers
80
views
How to tweak an XKB keymap without having to create my own under Wayland?
To access keys F13-F24 I recently needed to modify the file: `/usr/share/X11/xkb/symbols/inet`. This is the snippet, it's not all that interesting... ``` key { [ F13 ] }; key { [ F14 ] }; key { [ F15 ] }; key { [ F16 ] }; key { [ F17 ] }; key { [ F18 ] }; key { [ F19 ] }; key { [ F20 ] }; key { [ F2...
To access keys F13-F24 I recently needed to modify the file:
/usr/share/X11/xkb/symbols/inet
.
This is the snippet, it's not all that interesting...
key { [ F13 ] };
key { [ F14 ] };
key { [ F15 ] };
key { [ F16 ] };
key { [ F17 ] };
key { [ F18 ] };
key { [ F19 ] };
key { [ F20 ] };
key { [ F21 ] };
key { [ F22 ] };
key { [ F23 ] };
key { [ F24 ] };
After restarting the compositor this worked as expected.
The problem I now have is whenever this package gets updated it will overwrite my local configuration.
Everything I can find online explains how I can create my own keymap, which I'd rather avoid - I just want to make a small tweak to the existing keymap.
---
Is there a way to overlay some changes on the existing keymap in my user configuration without having to create a new keymap?
ideasman42
(1461 rep)
Apr 12, 2025, 10:11 AM
• Last activity: May 20, 2025, 09:52 PM
9
votes
2
answers
3029
views
xorg.conf XkbOption ignored for terminate:ctrl_alt_bksp to restart X
I want Ctrl + Alt + Bksp to restart X, so I created an `xorg.conf` rule: `/usr/share/X11/xorg.conf.d/53-zap.conf`: Section "ServerFlags" Option "DontZap" "false" EndSection Section "InputClass" Identifier "Keyboard Defaults" MatchIsKeyboard "yes" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSect...
I want Ctrl+Alt+Bksp to restart X, so I created an
xorg.conf
rule:
/usr/share/X11/xorg.conf.d/53-zap.conf
:
Section "ServerFlags"
Option "DontZap" "false"
EndSection
Section "InputClass"
Identifier "Keyboard Defaults"
MatchIsKeyboard "yes"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
And checking /var/log/Xorg.0.log
:
[ 1023.598] (II) XINPUT: Adding extended input device "Asus WMI hotkeys" (type: KEYBOARD, id 11)
[ 1023.598] (**) Option "xkb_rules" "evdev"
[ 1023.598] (**) Option "xkb_model" "pc105"
[ 1023.598] (**) Option "xkb_layout" "us"
[ 1023.598] (**) Option "xkb_options" "terminate:ctrl_alt_bksp"
[ 1023.598] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event3)
[ 1023.598] (**) AT Translated Set 2 keyboard: Applying InputClass "evdev keyboard catchall"
[ 1023.598] (**) AT Translated Set 2 keyboard: Applying InputClass "Keyboard Defaults"
[ 1023.598] (II) Using input driver 'evdev' for 'AT Translated Set 2 keyboard'
[ 1023.598] (**) AT Translated Set 2 keyboard: always reports core events
[ 1023.598] (**) evdev: AT Translated Set 2 keyboard: Device: "/dev/input/event3"
[ 1023.598] (--) evdev: AT Translated Set 2 keyboard: Vendor 0x1 Product 0x1
[ 1023.598] (--) evdev: AT Translated Set 2 keyboard: Found keys
[ 1023.598] (II) evdev: AT Translated Set 2 keyboard: Configuring as keyboard
[ 1023.598] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio0/input/input3/event3"
[ 1023.598] (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD, id
12)
[ 1023.598] (**) Option "xkb_rules" "evdev"
[ 1023.598] (**) Option "xkb_model" "pc105"
[ 1023.598] (**) Option "xkb_layout" "us"
[ 1023.598] (**) Option "xkb_options" "terminate:ctrl_alt_bksp"
The last line shows that it sees the directive.
And yet, when I open a terminal and type setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: us
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+us+inet(evdev)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
I _can_ force the option, setxkbmap -option terminate:ctrl_alt_bksp
,
giving me:
...
model: pc105
layout: us
options: terminate:ctrl_alt_bksp
Trying to build keymap using the following components:
...
And I test it and it restarts X
correctly.
I don't understand. I had this working last week, but now it doesn't load the XkbOption
from the xorg.conf
file. Is there another layer that sets XKB
settings that I don't know about?
I'm using Ubuntu 13.10, but with xmonad
. I load some gnome utilities (gnome-panel
, gnome-screensaver
, gnome-keyring-demon
), but not gnome-settings-daemon
.
reasgt
(813 rep)
Mar 31, 2014, 07:45 AM
• Last activity: May 1, 2025, 06:05 AM
13
votes
3
answers
1622
views
Using new (2019) Microsoft Ergonomic Keyboard - how to map emoji and office keys into something usable?
I bought a „Microsoft Ergonomic” keyboard to replace my used up Microsoft Natural. They moved „Win” key to the left and placed new „Office” and „Emoji” keys on the right instead: [![Alt, Office, Emoji - new keys][1]][1] By default, those keys seem to be not recognized by xorg (at least on Ubuntu 20....
I bought a „Microsoft Ergonomic” keyboard to replace my used up Microsoft Natural. They moved „Win” key to the left and placed new „Office” and „Emoji” keys on the right instead:
By default, those keys seem to be not recognized by xorg (at least on Ubuntu 20.04 I use).
I am looking for hints how to map those keys. I heavily used Win-… combinations in my custom keyboard shortcuts, so I press those keys repeatedly). I'd prefer to make the Office key behave as Win used to (Super if I recall), and map Emoji as some new modifier.
I tried

evtest
; it emits some key combinations. Both reports below are from a single keypress.
(Office)
Event: time 1604935916.773242, -------------- SYN_REPORT ------------
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1604935919.037417, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1604935919.037417, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 1
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1604935919.037417, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1604935919.037417, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
(Emoji)
Event: time 1604935938.159725, -------------- SYN_REPORT ------------
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1604935942.720256, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1604935942.720256, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 1
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1604935942.720256, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1604935942.720256, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1604935942.720256, -------------- SYN_REPORT ------------
Event: time 1604935942.728233, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7002c
Event: time 1604935942.728233, type 1 (EV_KEY), code 57 (KEY_SPACE), value 1
Event: time 1604935942.728233, -------------- SYN_REPORT ------------
^X@s^[^@Event: time 1604935942.872415, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7002c
Event: time 1604935942.872415, type 1 (EV_KEY), code 57 (KEY_SPACE), value 0
Event: time 1604935942.872415, -------------- SYN_REPORT ------------
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1604935942.880280, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1604935942.880280, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 0
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1604935942.880280, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1604935942.880280, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1604935942.880280, -------------- SYN_REPORT ------------
Mekk
(261 rep)
Nov 9, 2020, 03:24 PM
• Last activity: Apr 9, 2025, 04:45 PM
3
votes
4
answers
2409
views
bind CapsLock to Control on Ubuntu
I googled this topic and a lot of people suggesting setxkbmap -option ctrl:nocaps I put this line into my `.bashrc`. However, frequently this key binding is disabled automatically. This happens randomly when I am doing other things. It is the most annoying when I am using vim, a lot of key mappings...
I googled this topic and a lot of people suggesting
setxkbmap -option ctrl:nocaps
I put this line into my
.bashrc
. However, frequently this key binding is disabled automatically. This happens randomly when I am doing other things. It is the most annoying when I am using vim, a lot of key mappings are affected. I need to open a terminal to re-run the previous command, which will get it work for another random period of time until it is deactivated again.
Does any one shared the same experience? How to have this mapping permanently?
------------------
I finally figured out that it is ibus that resets the key map every time I change input engine.
doraemon
(491 rep)
Nov 7, 2017, 02:52 AM
• Last activity: Mar 21, 2025, 08:21 PM
2
votes
1
answers
132
views
Where are X11 KeySym defined?
I'm following [this tutorial][1] explaing that I can refer characters with their unicode, or with their name defined inside `/usr/include/X11/keysymdef.h`. However, this file doesn't exist on my (Debian) system. I ran a search with `sudo grep -rl "Greek_alpha"` inside `/usr`, but it gave me irreleva...
I'm following this tutorial explaing that I can refer characters with their unicode, or with their name defined inside
/usr/include/X11/keysymdef.h
. However, this file doesn't exist on my (Debian) system.
I ran a search with sudo grep -rl "Greek_alpha"
inside /usr
, but it gave me irrelevant results, nothing like the definitions I'm looking for. (Greek_alpha
is one of the aliases I'm looking for, you cand find one in usr/share/X11/xkb/symbols/gr
for example.)
Where can I find the complete list of these KeySyms / variables / aliases on my computer?
Cormor
(23 rep)
Mar 1, 2025, 01:04 PM
• Last activity: Mar 1, 2025, 10:51 PM
0
votes
1
answers
91
views
Swapping Ctrl, Win, and Alt in MX Linux (Xfce) – Issue with Alt Modifier
I'm using MX Linux with Xfce and trying to swap three keys: - Ctrl → Win (Super) - Win → Alt - Alt → Ctrl Swapping two keys at a time works using `setxkbmap`, for example: ```bash setxkbmap -option ctrl:swap_lalt_lctl ``` However, if I try to add a second swap, like: ```bash setxkbmap -option ctrl:s...
I'm using MX Linux with Xfce and trying to swap three keys:
- Ctrl → Win (Super)
- Win → Alt
- Alt → Ctrl
Swapping two keys at a time works using
setxkbmap
, for example:
setxkbmap -option ctrl:swap_lalt_lctl
However, if I try to add a second swap, like:
setxkbmap -option ctrl:swap_lalt_lctl,altwin:swap_alt_win
I end up with a repetition of the same key instead of a clean three-way swap.
### Attempted Solution
I created a custom XKB symbols file:
xkb_symbols "ctrl_win_alt_swap" {
include "us" // Keep the default US layout
key { [ Super_L ] }; // Left Ctrl → Left Win
key { [ Alt_L ] }; // Left Win → Left Alt
key { [ Control_L ] }; // Left Alt → Left Ctrl
};
I apply this with:
setxkbmap -layout custom -variant ctrl_win_alt_swap
The remapping works, except for one issue:
- Pressing **Alt alone** produces Ctrl
, which is expected.
- Pressing **Alt in combination with another key** results in **Ctrl+Alt**, instead of just Ctrl
.
Why does this happen, and how can I properly swap Ctrl, Win, and Alt without modifier conflicts?
igm2103
(1 rep)
Feb 2, 2025, 10:09 PM
• Last activity: Feb 4, 2025, 06:36 PM
2
votes
1
answers
240
views
What is an equivalent of loading an xkb keymap with xkbcomp for Wayland?
I had a [nice keymap](https://github.com/talwrii/symbolboard) that I defined with `xmodmap`, but I had some problems when using "cross platform apps" (specifical Chrome and Obsidian), so I fixed them by redefining it as an [xkb keymap](https://github.com/talwrii/symbolboard2). This worked fine, but...
I had a [nice keymap](https://github.com/talwrii/symbolboard) that I defined with
xmodmap
, but I had some problems when using "cross platform apps" (specifical Chrome and Obsidian), so I fixed them by redefining it as an [xkb keymap](https://github.com/talwrii/symbolboard2) . This worked fine, but then I wanted to switch to kde plasma on Wayland (do work around [this old bug](https://bugs.kde.org/show_bug.cgi?id=365255) that causes kde to bind keys it should not), and now it doesn't work any more.
I created the keymap by using xkbcomp :0 map.xkb
and then editting the map file and then loading it with xkbcomp map.xkb :0
. I did this because I wanted to change the modifiers and could not work out how to get the logic behind /usr/share/X11/xkb
to not not define default modifiers before loading my map. However, on wayland xkbcomp
appears to do nothing.
Is there an equivalent of xkbcomp map.xkb :0
for Wayland - or some way to reload a complete keymap without using all the rules in /usr/share/X11/xkb
?
# Related questions and research
This [question](https://unix.stackexchange.com/questions/309580/does-wayland-use-xkb-for-keyboard-layouts) talks about adding "partial keymaps" that wayland can look at, but I don't want to fight with all the events and rules - I need to remap modifiers (and xkb has no concept unmapping)
Att Righ
(1412 rep)
Jan 26, 2025, 08:03 PM
• Last activity: Jan 27, 2025, 07:46 PM
18
votes
2
answers
3227
views
Numpad emulation
My new laptop (Dell [Inspiron 5578][1]) has [no numeric pad][2]. Many laptops without dedicated numpad keys have numpad accessible through Fn , but not this one. When I run `xev` and try to use traditional Fn combos (e.g., Fn + J for 1 ), it sees no event. And the numbers are not even on the labels....
My new laptop (Dell Inspiron 5578 ) has no numeric pad .
Many laptops without dedicated numpad keys have numpad accessible through Fn, but not this one. When I run
xev
and try to use traditional Fn combos (e.g., Fn+J for 1), it sees no event. And the numbers are not even on the labels.
AFAIU, I cannot create any shortcut with the Fn key, because Fn is not passed to the OS.
But I could theoretically use Alt_L+Super_L instead. The question is how to do it properly. I'd prefer to do it on a lower level than keyboard layout in order to work well with all the VMs, even with non-Linux ones.
Environment: Qubes OS . The host part is based on Fedora.
I've tried:
* Bind an xdotool command via Xfce key shortcut. This produces various weird results: The command (xdotool key KP_1 and variations) usually works OK, but not when invoked by shortcut. When invoked by shortcut, the problem probably is that modifier keys are pressed at the time. I've tried various modifications (--clearmodifiers
, keyup for modifiers etc.), none of them works well.
* Do the same with autokey. I got some freezes of autokey.
Non-solutions:
* Use external numpad/keyboard: While I have a numpad (sort of) on my external keyboard, I'd like to have one even on the internal one, e.g., when travelling and it is impossible or at least uncomfortable to use the external keyboard.
* Use number row: In Czech layout, the number row is used primarily for accented letters. The layout I use (extracs variant of CShack ) does not have numbers in the “number row” at all.
* Buy a different laptop: It was hard to find a laptop satisfying my various requirements.
"Czech and Slovak 1337 keyboard CShack (translated from Czech)"
v6ak
(395 rep)
May 22, 2017, 01:43 PM
• Last activity: Jan 3, 2025, 12:27 PM
0
votes
1
answers
42
views
How do I change a key's interactions with Caps Lock using XKB?
I'm making a custom keyboard layout featuring small capital letters and I'd like to be able to use the caps lock key to type in all caps with it, but whether it's on or off, small capital letters are typed in by default. Is there a way to remedy this?
I'm making a custom keyboard layout featuring small capital letters and I'd like to be able to use the caps lock key to type in all caps with it, but whether it's on or off, small capital letters are typed in by default. Is there a way to remedy this?
Kschwal
(1 rep)
Nov 30, 2024, 08:13 PM
• Last activity: Dec 2, 2024, 12:17 PM
1
votes
0
answers
1358
views
Remapping Caps key to Esc key in Hyprland (Arch) from Colemak layout
I use the Colemak layout where both the backspace and the caps lock keys are mapped to backspace. I would like to remap the key that's Caps lock in querty to be the escape key, but can't figure out how to do it. Using `wev`, I know that the code of that key is 66. The [Hyprland wiki][1] explains how...
I use the Colemak layout where both the backspace and the caps lock keys are mapped to backspace. I would like to remap the key that's Caps lock in querty to be the escape key, but can't figure out how to do it.
Using
wev
, I know that the code of that key is 66.
The Hyprland wiki explains how to replace caps with esc using kb_options
, but this doesn't work for me since I don't have that key set to caps in my layout.
Anyone have advice for the cleanest way to do this?
styopa
(11 rep)
Dec 1, 2024, 05:04 AM
Showing page 1 of 20 total questions