I just accidentally pressed Ctrl+Shift+W again and lost some work. I like using CTRL+W for individual windows, but I never want to close everything. Is there a way to disable this on Chrome?
7 Answers
You can use AutoHotkey to intercept the keyboard shortcut:
SetTitleMatchMode, Regex
#IfWinActive, (- Google Chrome)$
^+w::
;do nothing
return
#IfWinActive
-
1This example did not work for me with AutoHotKey v1.1.09.02. After some tweaking I got this working: #IfWinActive, ahk_class Chrome_WidgetWin_1 ^w::Return #IfWinActive Jan 19, 2013 at 21:45
The answer by iglvzx doesn't work for newer versions of AutoHotKey (AHK). Here is how you can do it with newer AHK versions:
SetTitleMatchMode, Regex
#IfWinActive, ahk_class Chrome_WidgetWin_1
^+w::
;do nothing
return
^+q::
;do nothing
return
#IfWinActive
This also prevents Ctrl+Shift+Q from quitting all of Chrome.
Complete version of this script. Works on new AHK versions.
- Works with any input language (assigned to key code, not key as letter)
- Only one running instance (SingleInstance force)
- Doesn't recording history of pressed keys (KeyHistory 0)
- Prevents from Ctrl+Shift+W and Ctrl+Shift+Q in Chrome
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #SingleInstance force; #KeyHistory 0 ; SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, Regex #IfWinActive, ahk_class Chrome_WidgetWin_1 ^+SC011:: ;do nothing return ^+SC010:: ;do nothing return #IfWinActive
-
-
1
-
The chrome keybinding is language dependent for at least my version (61.0.3163.100) of chrome, so it doesn't work better to use the scancode. Oct 4, 2017 at 20:04
- Install the Chrome extension "Disable keyboard shortcuts", by Benjamin Barenblat. (You may also view the source code, if you wish.)
- Visit the URL:
chrome://extensions/shortcuts
- If you're on Windows, assign Control+Shift+W to do nothing in Chrome. (If you're on Mac OS, assign Cmd+Shift+W instead.)
This binds ctrl-w to perform a kind of select-word in every application, and disables closing chrome using ctrl-shift-w and ctrl-shift-q. Tested on english and french language input methods for windows 10.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. #SingleInstance FORCE #KeyHistory 0 SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ^w:: ; select word Send, ^{right}^{left}^+{right} return SetTitleMatchMode, Regex #IfWinActive, ahk_class Chrome_WidgetWin_1 ^+w::return ; make ctrl-shift-w do nothing ^+q::return ; make ctrl-shift-q do nothing #IfWinActive
Here is the autohotkey code to disable ctrl+w and ctrl+q for the tab named test1 and test2 (test1 is the title that appears on your tab. You can use also use autohotkey spy to figure out more stuff)
SetTitleMatchMode, Regex
#If WinActive("test1 ahk_class Chrome_WidgetWin_1") || WinActive("test2 ahk_class Chrome_WidgetWin_1")
^w::
^q::
return ; do nothing
#IfWinActive
it think this might work:
1- Press WIN + R
to open Run dialog (alternatively right click Start, select Run), type control /name Microsoft.Language
, press OK:
2- This opens Control Panel > All Control Panel items > Language. Select Advanced settings:
3- Select Change language bar hot keys:
4- In Advanced Key Settings tab, select Change Key Sequence:
5- Change key sequence, click OK to save settings:
6- Notice that Switch Input Language and Switch Keyboard Layout can't have the same sequence. To avoid using CTRL + SHIFT
you can for instance set Switch Input Language to Grave Accent and Switch Keyboard Layout to Left Alt + SHIFT
Ctrl
+Shift
+Q
in Cloud9 IDE, but that closes my Chrome :(