Disable hardwired chrome hot key ctrl+w?

19

5

Using Chrome's Remote Desktop I would like to pass Ctrl+W to an application on the other PC but that actually closes my Chrome window. Any way of disabling shortcut keys in Chrome?

I searched through the web but didn't find any hacks. I added the shortcut manager extension but that can't manage the Ctrl+W shortcut or some other shortcuts.

obeliksz

Posted 2013-03-21T06:28:35.503

Reputation: 343

Answers

-1

hmmm... I understand your question, but the "Ctr + W" command closes the current tab in any browser not just google chrome.

My research did find people who have solved this issue:

hinekyle

Posted 2013-03-21T06:28:35.503

Reputation: 290

This part of Google Chrome is really baaad. Anyways, the hacking solution that I have found is to pass a key combination that is not predefined and then on the other pc understand that as I wanted. So for with Ctrl+W I have chosen Ctrl+End using a little AHK script: SetKeyDelay, -1 ^End::^w So the answer is Chrome failed on this but there are working custom hacks... – obeliksz – 2013-03-23T13:07:37.697

11

Only solution that worked for me was to rebind ctrl+w to some extension keyboard shortcut.

  1. go to chrome://extensions

  2. at bottom right look for keyboard extensions

  3. add ctrl+w as shortcut to any chrome extension you like.

Now, ctrl+w does not close the browser tab.

xxx374562

Posted 2013-03-21T06:28:35.503

Reputation: 141

5This is perfect for me, but I didn't have any spare extensions to map to. So I wrote one! It's called "ctrlw". It provides two commands, one which does nothing (to map to ctrl+w) and one which closes the window (which I map to alt-w). Problem solved! – samson – 2018-08-01T21:32:16.040

Just to note, the "Keyboard shortcuts" option is now in the menu (opened by clicking the menu button in the top-left), or you can go directly to chrome://extensions/shortcuts. – Harry Cutts – 2019-03-05T19:19:27.497

3

It's extremely annoying since Ctrl+W is the vim equivalent of Ctrl+Backspace. I wrote this little Tampermonkey script to temporarily place an event listener on the page unload event:

// ==UserScript==
// @name       disable ctrl+w
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @description  disable ctrl+w
// @match      http://*/*
// ==/UserScript==

document.addEventListener('keydown', function(evt){

    // NOTE: ctrl key is sent here, but ctrl+W is not
    if (evt.ctrlKey) {

        var stopEvilCtrlW = function(e) {
            return "Oopsies, Chrome!";
        },  clearEvilCtrlW = function() {
            window.removeEventListener('beforeunload', stopEvilCtrlW, false);  
        };

        setTimeout(clearEvilCtrlW, 1000);
        window.addEventListener('beforeunload', stopEvilCtrlW, false);
    }

}, false);

glitchyme

Posted 2013-03-21T06:28:35.503

Reputation: 141

3

The ctrl+w key is used in the nano editor on linux systems. When using crosh in Google chrome this key combination results in a prompt to close the current window.

Try using ctrl+alt+w

Works for me when connecting to remote systems via ssh using crosh.

NeptuneUK

Posted 2013-03-21T06:28:35.503

Reputation: 31

I'm not sure this answers the OP questions, but it's just what i was looking for, how to use vim in the Chrome SSH terminal. Thanks! – bradleybossard – 2015-10-13T20:41:25.267