如何為 Chrome 新增自訂鍵盤快速鍵

如何為 Chrome 新增自訂鍵盤快速鍵

我暫時想放棄 FireFox,因為與 Chrome 相比,運行速度的差異太大了。但我似乎找不到一種方法來複製對我來說至關重要的功能:能夠打開新分頁並讓它們使用鍵盤快捷鍵直接轉到某個地址。

「著名的」擴充 ShortKeys 似乎在最新版本的 Chrome (58) 中不起作用。

有一個關於 Chrome 的問題,但它已經很舊了,而且那裡的答案無效和/或過時。我需要 2017 年的解決方案:)。

答案1

這真的很容易做到自動熱鍵。只需編寫一個在 Chrome 開啟時執行的腳本,並使用您想要的任何熱鍵。您所要做的就是發送一個 cntrl-t 和您想要前往的地址,然後輸入。

答案2

作為對 AHK 評論的回應,這裡有一個腳本可以完全滿足您的要求。

儘管您認為這是一種“解決方法”,但它的工作原理完全符合您的要求。它使用熱鍵在 Chrome 中開啟預定義頁面。誰關心哪個 exe 處理它?

; Only allow 1 instance of the script to run
#SingleInstance, Force
return

; Hotkeys past here only work when chrome.exe is the active window.
#IfWinActive, ahk_exe chrome.exe

; Press F1 while in chrome...
F1::
    ; To run chrome at the specified address.
    Run, % "chrome.exe https://superuser.com/questions/1212547/how-to-add-custom-keyboard-shortcuts-to-chrome/"
return

; Press F2 while in chrome...
F2::
    ; Open a new tab.
    Send, ^t
    Sleep, 100

    ; And then send this reddit's AHK help forum, plus the enter key, to the address bar.
    SendInput, www.reddit.com/r/autohotkey{Enter}

; Hotkeys past this will work globally
#IfWinActive

相關內容