I'm on Ubuntu 20.04 (GNU Emacs 26.3), and I would like to swap the Hyper and Ctrl keys. Basically, I have a keyboard map set up (with xkb) that suits my needs, except that in emacs (and only in emacs), I would like the Hyper and Ctrl keys to be swapped.

Based on this How to have Emacs treat left Ctrl as Hyper? I've tried adding this

(setq x-ctrl-keysym 'hyper)
(setq x-hyper-keysym 'ctrl)

to .emacs. However, it doesn't have the desired effect. (Incidentally, the variable ns-control-modifier doesn't seem to be defined.)

Ideally, I would like to only swap these keys in the Emacs GUI, but not in the Gnome Terminal (when invoked with emacs -nw).

What am I doing wrong?

  • ns- stuff is for MacOS / OSX, so whatever the solution is, it won't be setting a ns- something or other. – lawlist Jan 11 at 6:55

Your Answer

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

Browse other questions tagged or ask your own question.