36

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?

music2myear
  • 49,799

7 Answers7

24

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.

Raj
  • 342
10

You can use AutoHotkey to intercept the keyboard shortcut:

SetTitleMatchMode, Regex

#IfWinActive, (- Google Chrome)$
    ^+w::
        ;do nothing
        return

#IfWinActive
iglvzx
  • 23,818
3

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
robertono
  • 31
  • 4
3
  1. Install the Chrome extension "Disable keyboard shortcuts", by Benjamin Barenblat. (You may also view the source code, if you wish.)
  2. Visit the URL: chrome://extensions/shortcuts
  3. 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.)

chrome://extensions/shortcuts Do nothing ctrl-shift-w In Chrome

mwfearnley
  • 7,889
0

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
0

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

credit to Raj and this guy

JinSnow
  • 912
0

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