Chaoses-Ib / IbEverythingExt

Everything 拼音搜索、快速选择扩展
MIT License
1.2k stars 68 forks source link

有无可能加入一个双击快捷键 运行/打开 权重最高/排在首位的项目? #54

Open jonozw opened 2 years ago

jonozw commented 2 years ago

分类: 需求 版本: N/A

IbEverythingExt当前打开某个搜索后的结果项目的做法是, 搜索完毕后, 通过 ctrl+alt+[0-9] 运行某个编号的项目. 但是毕竟ctrl+alt+[0-9]按起来很麻烦.

能否让用户自行选择一个键, 比方说 TAB/CapsLock或者 ` , 双击这个指定的键, 直接运行 权重最高/排在首位 的项目? 这样很容易形成肌肉记忆, 会很便捷.

谢谢

jonozw commented 2 years ago

AutoHotKey不熟悉

能否求一段代码, 实现 只在Everything窗口内监控 TAB按键. 其他程序正常响应TAB.

在Everything内部, 快速连击(300ms内)TAB -> ctrl+alt+1 非快速连击, 依然是正常的TAB?

谢谢

Chaoses-Ib commented 2 years ago

临时解决方案:使用 AutoHotkey 映射: dbpress.zip

#UseHook
SendMode "Input"

#HotIf ActiveWindowIsEverything()

Tab::
KeyTab(ThisHotkey)  ; This is a named function hotkey.
{
    static presses := 0
    if presses > 0 ; SetTimer already started, so we log the keypress instead.
    {
        presses += 1
        return
    }
    ; Otherwise, this is the first press of a new series. Set count to 1 and start
    ; the timer:
    presses := 1
    SetTimer After, -300 ; Wait for more presses within a millisecond window.

    After()  ; This is a nested function.
    {
        if presses = 1 ; The key was pressed once.
        {
            Send "{Tab}"
        }
        else if presses = 2 ; The key was pressed twice.
        {
            Send "^!1"
        }
        ; Regardless of which action above was triggered, reset the count to
        ; prepare for the next series of presses:
        presses := 0
    }
}

#HotIf

ActiveWindowIsEverything() {
    window_class := ""
    try window_class := WinGetClass("A")
    return (window_class ~= "^EVERYTHING") != 0
}
jonozw commented 2 years ago

多谢弟兄[抱拳]