29

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.

22

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.

3
6

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);
1
  • Or instead of ctrlKey check and 1 second timeout we can test event.keyCode == 17 in keydown and keyup and set a boolean flag to check later in beforeunload
    – basin
    Mar 3 at 6:44
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.

2
  • 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! Oct 13 '15 at 20:41
  • CTRL + ALT + W didn't work for me, but CTRL + SHIFT + W worked. Oct 6 '20 at 3:11
0

Most of the solutions don't work anymore. I want to use nano text editor with CTRL+W key in my linode lish web gui, in order to search for a text, I need to use CTRL+W key but that just terminated my window.

In chrome browser, if you pin the browser window, then if you press CTRL + W it will also close the browser window.

but,

in opera browser, if you pin the browser window, then if you press CTRL + W it will not close the browser window.

So, my solution is to use Opera Browser.

0

On the your system on which CRD window opens, create custom keyboard shortcut "Do nothing" enter echo as a command. Bind it to Ctrl+w. It disables it. Just tried a second ago and it worked.

0

I am an extensive VIM user, and I had the same issue. Installing "Chrome Remote Desktop" app and using it to connect instead of using "Google Chrome" tab resolved the issue for me.

-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:

1
  • 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
    Mar 23 '13 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.