我是 Emacs 用戶,我希望長按 Enter 作為額外的控制鍵。我曾經在 Mac OS 中使用 KeyboardRemap4Macbook 執行此操作。但無法找到在 Ubuntu Unity 中如何操作。這將大大節省我的左手手指:)
答案1
透過使用 xcape (sudo apt-get install xcape
或來自 github -https://github.com/alols/xcape)
並遵循自述文件中的腳本:
# Map an unused modifier's keysym to the spacebar's keycode and make it a
# control modifier. It needs to be an existing key so that emacs won't
# spazz out when you press it. Hyper_L is a good candidate.
spare_modifier="Hyper_L"
xmodmap -e "keycode 65 = $spare_modifier"
xmodmap -e "remove mod4 = $spare_modifier" # hyper_l is mod4 by default
xmodmap -e "add Control = $spare_modifier"
# Map space to an unused keycode (to keep it around for xcape to
# use).
xmodmap -e "keycode any = space"
# Finally use xcape to cause the space bar to generate a space when tapped.
xcape -e "$spare_modifier=space"
無論發行版如何,這對我來說都有效 - 我已經在 Fedora 23 和 Debian9 上以及 Ubuntu 17.04 以外的版本上工作了,因為它是一個通用解決方案。謝謝