使用AutoHotkey实现分层键盘:自定义逗号键行为方案咨询
解决方案
核心修改说明
你现有脚本已经实现了大部分映射逻辑,只需要微调2行代码即可满足全部需求:
- 你已写的
,::Backspace已经实现了单独按下逗号触发退格的功能,这部分无需修改 - 你提前将
CapsLock映射为了Alt,因此CapsLock+,等价于AHK中的!,热键,你原脚本中该热键输出为],只需修改对应输出值为}即可,原输出]的逻辑可以调整到!.热键上
修改后的核心配置片段
; 单独按逗号触发退格,原有逻辑无需改动 ,::Backspace ; CapsLock+, 输出},修改原有!,对应的Send值 !,:: Send, {}} return
完整修改后脚本
#SingleInstance Force #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ; For easy access of Control Key LAlt::Ctrl ; Use Alt as Snap keys CapsLock::Alt '::Alt `;::Enter ,::Backspace .::Ctrl /::Shift !a:: Send, ~ return !s:: Send, = return !d:: Send, ‘ return !f:: Send, “ return !g:: Send, - return !z:: Send, < return !x:: Send, {{} return !c:: Send, [ return !v:: Send, ( return !b:: Send, / return !{:: Send, | return !}:: Send, Ctrl return !h:: Send, {+} return !j:: Send, , return !k:: Send, . return !l:: Send, {Esc} return ; the following will now work currently cause ; has already been mapped to Enter key, find a solution !`;:: Send, ? return !n:: Send, \ return !m:: Send, ) return !,:: Send, {}} return !.:: Send, ] return !/:: Send, > return
跨平台适配提示
AutoHotkey仅支持Windows系统,Mac端要实现同款映射可以使用Karabiner-Elements工具,按照相同的逻辑配置按键映射即可。
内容的提问来源于stack exchange,提问作者myaliasname3333
相关产品推荐
相关产品推荐

