Files
CapSpace/CapSpace.ahk

44 lines
1.1 KiB
AutoHotkey
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#Requires AutoHotkey v2.0
#SingleInstance Force
InstallKeybdHook ; 强制安装键盘钩子,提高对物理按键状态感知的准确性
; 关键优化:将掩码键设为 vkE8。
; 这样 AHK 在屏蔽 Win/Alt 的菜单功能时,不会发送干扰 Typeless 的 Ctrl 信号。
A_MenuMaskKey := "vkE8"
; 1. 优化 RAlt 穿透逻辑
; 使用 ~ 确保信号能传给 Typeless同时用 $ 防止热键自我触发
~$RAlt::return
; -------------------------------------------------------------------------
; 2. 虚拟桌面切换逻辑 (使用之前优化的防残留方案)
; -------------------------------------------------------------------------
*^Left:: {
SendInput("#^{Left}")
SafeRelease()
}
*^Right:: {
SendInput("#^{Right}")
SafeRelease()
}
*^Up:: {
SendInput("#^{Left 10}")
SafeRelease()
}
*^Down:: {
SendInput("#^{Right 10}")
SafeRelease()
}
; 辅助函数:彻底清除 Win 键残留,并给系统一点微小的缓冲时间
SafeRelease() {
; 强制释放 Win 键
SendInput("{LWin up}{RWin up}")
; 如果切换后 RAlt 依然失灵,取消下面这行的注释(加 50ms 缓冲)
; Sleep 50
}