Unix & Linux Asked by Silvio Mayolo on December 15, 2021
setxkbmap
has always been a healthy bit of black magic as far as I’m concerned. I recently installed Dyalog APL. When I run the command dyalog
, it globally changes my keyboard configuration to APL mode, which effectively disables my ability to use the Super key for anything else. Now, this is actually quite nice while I’m using APL. But then when I close the process, I’m left with a nigh-worthless Super key that can’t do any of its usual functions, like switch between windows or open the Activities menu. So my question is, how do I change it back?
Specifically, here’s the "normal" output of setxkbmap -print
, on a fresh login.
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+us:2+inet(evdev)+capslock(ctrl_modifier)"};
xkb_geometry { include "pc(pc105)" };
};
(The caps lock/ctrl modifier is unrelated to this question, so feel free to ignore that)
When I run Dyalog, it changes my keyboard map, so setxkbmap -print
becomes
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+apl(dyalog):2+us:3+inet(evdev)+group(win_switch)+capslock(ctrl_modifier)" };
xkb_geometry { include "pc(pc105)" };
};
So what setxkbmap
command(s) can I run to go from the second state back to the first one? I want to be able to get the default behavior of my Super key back, on demand.
I’m running Ubuntu 18.04.3 LTS, with Gnome 3.28.4 on X11, if any of that matters for the purposes of this question.
What about using directly the APL keymap shipped with XKB?
Have a look into /usr/share/X11/symbols/apl, you can use it as a secondary layout.
Answered by pillule on December 15, 2021
I don't believe you can use the output of setxkbmap -print
for that,
but there are at least three other approaches to restore the default
keyboard state.
Execute
xkbcomp "$DISPLAY" normal.xkb
while the keyboard is in its default state. Xkbcomp creates normal.xkb
file, the keyboard's complete default keymap. After you are done with Dyalog,
the keyboard state can be easily restored with
xkbcomp normal.xkb "$DISPLAY"
From man keyboard
, for Debian based systems:
udevadm trigger --subsystem-match=input --action=change
Retrieve from /etc/default/keyboard
the relevant settings for
the setxkbmap
command:
setxkbmap [-model xkb_model] [-layout xkb_layout] [-variant xkb_variant] [-option xkb_options]
For example, given this /etc/default/keyboard
,
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS="caps:swapescape,terminate:ctrl_alt_bksp"
You would restore that default state with
setxkbmap -model 'pc105' -layout 'us' -option 'caps:escape,terminate:ctrl_alt_bksp'
Answered by Quasímodo on December 15, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP