Try with Return if this doesn’t work.
First you need to remove Hyper from the mod4 group of modifiers[fn:1], because it will most likely be interpreted as Super. To do that:
xmodmap -e "remove mod4 = Hyper_L"
xmodmap -e "add mod3 = Hyper_L"
Following that, we have now three options.
One alternative solution is to have Return be interpreted as both Hyper_L
and
Return at the same time. To do that, instead of doing the above, simply add
Return to the mod3
group
xmodmap -e "add mod3 = Return"
after all of the above. This also has a little annoyance, although admittedly
its much better than the above, that after pressing Return and then another key
really fast, it will first get registered as Return which removes the delay, but
it will also, at the same, get registered as Hyper_L
, so if you type, say,
Return and then right after “j”, the “j” wouldn’t be recognized by the program
you’re using because it will view it as Hyper + j. This is a bit better than the
other solution, but still not ideal.
This is my preferred solution, and the simplest.
Then, using xmodmap
, assign the keycode (use xev=[fn:2] if you don't know the
keycode for your Return) for the Return key to =Hyper_L
.
xmodmap -e "keycode 36 = Hyper_L"
Now, map the Return key to the special keycode any
so that xcape
knows about
it.
xmodmap -e "keycode any = Return"
And finally, use xcape
to make Return, which is now your modifier Hyper_L
,
generate an Return when pressed and released.
nice -n -30 xcape -e "Hyper_L=Return"
This has a little delay, and that’s why I chose to do it on the Return key instead of Escape, because usually I don’t type return followed immediately by another key like I do with Escape.
[fn:1] Each modifier has a group that it is assigned by default, to get a list
of the groups and the modifiers assigned to it call xmodmap -pm
.
[fn:2] This one liner makes xev
output only print out the (usual) relevant
information: xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf
"%-3s %s\n", $5, $8 }'
. To make it into an alias for your shell, don’t forget
to escape with \
all the double quotes and $
in the command.