How to remap capslock key to EMACS super using Autohotkey?

让人想犯罪 __ 提交于 2019-12-06 04:40:10

Another page on emacswiki suggests this in AutoHotKey:

#IfWinActive emacs  ; if in emacs
+Capslock::Capslock ; make shift+Caps-Lock the Caps Lock toggle
Capslock::Control   ; make Caps Lock the control button
#IfWinActive        ; end if in emacs

I don't know what Super does, but I mapped CapsLock to Emacs using this script:

CapsLock:: 
  ifwinactive ahk_class Emacs
    send {f16}
return

This sends f16 to emacs when emacs is active and capslock is pressed. My keyboard does not have an f16 key, that's why I chose that and in emacs I bound it to some function:

(global-set-key (kbd "<f16>") 'some-function)

Note that the AHK script does nothing with capslock when emacs is not active. I prefer that, because I consider capslock useless and I press it only accidentally, so it's OK if it does nothing then. You might want to do something else with it if the ifwinactive yields false.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!