Can emacs running under urxvt be made to recognize Hyper? From what I can tell, it doesn't distinguish hyper+something from just plain unmodified something. urxvt itself does recognize the modifier, I am told. But I cannot work out whether emacs in turn can, and if so how to configure this.
-
Source code says it recognizes it - that's a place to start... – Thomas Dickey Jul 02 '18 at 21:43
1 Answers
Yes, you may not even need to play with xmodmap
, nor modifiers, just bind them in your ~/.Xdefaults
like this:
URxvt.keysym.XF86AudioPlay: string:\030@m
URxvt.keysym.Menu: string:\030@s
URxvt.keysym.Muhenkan: string:\030@h
How it works
To get a good explanation on how key events are handled, see How do keyboard input and text output work? first.
TL;DR: Let's take "C-a" as an example, emacs won't receive "Ctrl down, a down, a up, ctrl up", urxvt does, and convert it to \1
(yes, ctrl- sequences are short, C-a
maps to \1
, C-b
maps to \2
, C-c
maps to \3
and so on).
Here my modification happen very late in the process, when urxvt send the escape sequences. I'm asking urxvt to send \030@m
to emacs, which is C-x @ m
(look at man ascii, 030 on the left column is conveniently aligned with X on the right column). C-x @ m
adds the meta modifier, C-x @ s
adds the super modifier, and C-x @ h
adds the hyper modifier (see https://www.gnu.org/software/emacs/manual/html_node/emacs/Modifier-Keys.html).
Happen on my keyboard I have XF86AudioPlay, Menu, and Muhenkan keys conveniently placed near to my Ctrl key, so I bound meta, super, and hyper to them.
There may be a better solution, we'd have to learn how emacs expects to receive meta and hyper escape sequences, to send directly the right one instead of using the C-x @ s
workaround, intended to be used when one does not have said keys.

- 609