Marc Wäckerlin
Für eine libertäre Schweiz

Overwrite Console Key Mapping Ctrl+Alt+F1

December 14, 2016

After an Ubuntu 14.04 / KDE 4 update, I had the problem that the key strokes Alt+F1Alt+F12 switched to the console terminal, also Alt+ and Alt+. Normally this is bound to Ctrl+Alt+Function-Key. I still don’t know why it has changed, but of course I wanted to get rid of this disturbing behaviour, since I have other actions on these keys. It was quite difficult to find the necessary instructions, so I describe it here:

The configuration is in /etc/console-setup:

  • On boot, /etc/init/console-setup.conf loads /etc/console-setup/cached.kmap.gz
  • The tty-consoles are named Console_1Console_12
  • Find a specific key code:
    • Use Ctrl+Alt+F1 to switch to a terminal
    • Call showkey — this does not work in the desktop
  • Backup the current configuration: dumpkeys > backup.kmap
  • Copy backup.kmap and edit the new file according to your needs
  • For my whishes, remove all console related hot keys, except for Ctrl+Alt combinations:
    • Create the new key map file:

      sudo -Hi
      cd /etc/console-setup
      dumpkeys > backup.kmap
      sed '/^\t*control\t*alt\t*keycode.*Console_/!{/Console_/d};/\(De\|In\)cr_Console/d;' backup.kmap > mrw.kmap
      loadkeys mrw.kmap
    • Load and test the new key map file:
      loadkeys mrw.kmap
    • Edit /etc/init/console-setup.conf, change /etc/console-setup/cached.kmap.gz to /etc/console-setup/mrw.keymap:
      description     "set console keymap"
      start on (virtual-filesystems
                or starting rcS
                or starting mountall-shell)
      exec loadkeys /etc/console-setup/mrw.kmap
  • Restore the old behaviour, call sudo loadkeys /etc/console-setup/backup.kmap and change back /etc/init/console-setup.conf.

comments title