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.

2 Answers 2


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.

Option 0


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"

Option 1

From man keyboard, for Debian based systems:

 udevadm trigger --subsystem-match=input --action=change

Option 2

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,


You would restore that default state with

setxkbmap -model 'pc105' -layout 'us' -option 'caps:escape,terminate:ctrl_alt_bksp'
  • Excellent! For whatever reason, Option 1 had no effect for me. But Option 2 works a charm. Unfortunately, to get my caps/ctrl behavior back, I have to go into Gnome Tweaks and poke that setting as well, but I imagine I can figure out how to get around that with XKBOPTIONS now that I know where to look. Thanks! Jul 29, 2020 at 23:41
  • @SilvioMayolo Option 1 requires sudo/root and a Debian based system, maybe it was that. But so glad to hear Option 2 it works. I regard every solution on the arcane keyboard utilities a victory! Yes, you are probably able to do it if you set XKBOPTIONS appropriatedly, and then you put Gnome Tweaks aside. man xkeyboard-config contains the relevant info.
    – Quasímodo
    Jul 30, 2020 at 12:30
  • @SilvioMayolo I have added one more (probably the most elegant, simple and reliable) option. You may want to try that
    – Quasímodo
    Oct 20, 2020 at 11:42

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.