31

如何停用 Google Chrome 內建的 Ctrl-W 關閉頁籤快速鍵...

 3 years ago
source link: https://blog.miniasp.com/post/2020/09/29/Disable-Ctrl-W-keyboard-shortcut-in-Google-Chrome
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
choose_the_right_partner3.png

昨天試用了一下 GitHub Codespaces 這套完全線上使用的整合開發環境,這套基於 Visual Studio Code 的雲端版本功能相當完整,所有在地端 Visual Studio Code 的設定,都可以全自動同步上去,所有擴充套件也都可以用。但唯一的不便之處,就是 Chrome 預設的 Ctrl-W (關閉目前頁籤) 快速鍵,會自動覆蓋掉 Visual Studio Code 常用的 Ctrl-W (關閉目前檔案),可是這個快速鍵又這麼常用,所以一不小心就會關閉線上編輯器。因此,我研究出兩種方法有效避免頁籤被關閉!

透過 Tampermonkey 擴充套件

這個做法是透過 Tampermonkey 擴充套件的 Userscript 使用者腳本指令碼,替特定網頁加入一段 JavaScript 程式碼,避免網頁被意外關閉。我個人比較喜歡這種做法,不用調整操作習慣。

透過 Better Ctrl-W 擴充套件

這個做法是透過 Better Ctrl-W 將 Chrome 內建的 Ctrl-W 快速鍵取消作用。

  1. 安裝 Better Ctrl-W 擴充套件

  2. 開啟 Chrome 擴充功能的「鍵盤快速鍵」頁面

    chrome://extensions/shortcuts
    
  3. 重新綁定快速鍵

    請將 Ctrl-W 綁定到 Do absolutely nothing 即可停用 Chrome 預設 Ctrl-W 快速鍵!

    再將 Alt-W 綁定到 Close highlighted tabs 即可用來取代原本關閉頁籤的快速鍵!

    將  綁定到 Do absolutely nothing 即可停用 Chrome 預設  快速鍵!
    1. 當你設定好之後,網頁中就再也抓不到任何 Ctrl-W 快速鍵了喔!
    2. 這擴充套件還無法針對特定網站停用 Ctrl-W 快速鍵,但已經看到有 Issue 被提出,希望未來可以加上,畢竟並非所有網站都需要特別關閉 Ctrl-W 快速鍵!

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK