My keyboard setup at home under MacOS uses Karabiner to "Change return to control if pressed with other keys, to return if pressed alone" and it works fine also inside Linux VirtualBoxes.

At work I have a Windows PC and to have the same behaviour I use AutoHotkey with

return::send {lctrl down}
return up::send % (a_priorkey = "enter") ? "{lctrl up}{return}" : "{lctrl up}"

but unfortunately inside Linux VMWares it doesn't work.

Is there a way to have the behaviour in Linux either passing the keystroke from host to guest or running a remapping tool under Linux?


At the end I've found a solution Remap Return to Control that use a couple of tools: xmodmap and xcape. Put the following lines in your .bash_profile

xmodmap -e "remove Control = Control_R"
xmodmap -e "keycode 0x69 = Return"
xmodmap -e "keycode 0x24 = Control_R"
xmodmap -e "add Control = Control_R"

xcape -t 5000 -e "Control_R=Return"

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.