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?
-
3It's a shame hotkeys **still** cannot be disabled/altered. I would like to use `Ctrl` + `Shift` + `Q` in [Cloud9 IDE](https://c9.io/), but that closes my Chrome :( – Richard de Wit Jan 20 '15 at 15:58
-
2This is not a Windows-specific issue. It is a general browser issue and these browsers (Chrome and Firefox) both use these same hot-key combos in Ubuntu linux as well. AHK doesn't support other OSes, but I wonder if there are solutions that could work for those OS as well. – music2myear Jan 05 '17 at 18:27
-
For MacOS the chrome installation has an option "Warn before quitting" in the Chrome menu. It's saved me many times over. – Rebecca Dessonville Jan 05 '17 at 22:40
-
[Here](https://superuser.com/q/704779/656580) you can find more options even without using AutoHotkey. I really like [this approach](https://superuser.com/a/1097584/656580). – Michael Berdyshev Feb 06 '18 at 18:07
-
This is a good question! I often use the middle of a pinky to press ctrl and another finger to press w to close individual tabs. It is so easy for the pinky to sometimes also press the large shift key right above ctrl. I don't want to have to use autohotkey though to remedy this. – user3015682 May 26 '19 at 03:19
7 Answers
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.
- 330
- 6
- 17
-
-
This should be the default answer. This also works with Firefox Quantum if you change the `ahk_class` to `MozillaWindowClass` – ifconfig Nov 19 '17 at 22:45
-
Ctrl+Shift+Q is disabled now in one of the latest chrome updates, so it is no longer necessary to block – pfg Nov 03 '18 at 21:03
You can use AutoHotkey to intercept the keyboard shortcut:
SetTitleMatchMode, Regex
#IfWinActive, (- Google Chrome)$
^+w::
;do nothing
return
#IfWinActive
- 23,459
- 13
- 85
- 122
-
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 – Steven Devijver Jan 19 '13 at 21:45
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
- 31
- 4
-
-
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. – William Cushing Oct 04 '17 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.)
- 1,573
- 5
- 20
- 31
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
- 101
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
- 774
- 11
- 25
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