Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I like to make connections so I can remember keyboard shortcuts. I get Ctrl+T to open a new tab - but what's the logic behind Ctrl+W to close one?

share|improve this question
5  
May have to do with cmd-w to close windows on Macs from a few places I looked. –  ekaj Feb 25 at 22:07
7  
Ctrl+W has also been the shortcut to close the currently focused window on Windows for quite a long time. I would assume it was chosen because W -> Window and it's on the left side of the keyboard. –  Oliver Salzburg Feb 25 at 22:23
17  
Ctrl+W also closes tabs on Firefox, Opera and Chrome –  Ben Johnson mk2 Feb 25 at 22:42
11  
It's there to troll people, mostly because Ctrl+Q quits the browser altogether for most modern browsers and Q and W are right next to each other on QWERTY layouts. –  TC1 Feb 26 at 13:44
3  
As a long time user of an emacs-clone (lugaru epsilon, since version 3 or so) on DOS then Windows, the sudden introduction of that shortcut is annoying. On a traditional emacs binding, Ctrl+W is bound to kill-region, which is the most common command I use to cut selected text to the clipboard. When typing in a another context (like this comment right here) typing Ctrl+W has a very different and rather more catastrophic effect. Switching among several editor key bindings on the same machine is always a pain, but this one is relatively new compared to my history with epsilon. –  RBerteig Feb 26 at 22:37

3 Answers 3

The W in Ctrl+W was chosen because previous to tabbed browsing being introduced (and currently, if you have tabbed browsing disabled) it's a shortcut to Close the Current Window.

Keyboard Shortcuts for Internet Explorer 6:

Close the current window - CTRL+W

Keyboard Shortcuts for Internet Explorer 8:

Close current tab (or the current window if tabbed browsing is disabled) - CTRL+W

Keyboard Shortcuts for Internet Explorer 11:

Close tab - Ctrl+W

share|improve this answer
    
didn't Office also use it to close the current document? –  ratchet freak Feb 26 at 9:23
5  
Note: it nearly universally closes the currently-active window across all programs. –  Joseph Hansen Feb 26 at 19:05
    
@rachet freak: Yes it was, it was a bit dangerous, since ctrl-q was left-align text (ctrl-e was center and ctrl-r was right-align). –  Atheist Feb 27 at 10:51
    
The other nasty thing is that Ctrl-w is used in applications like vim and several terminal emulators to delelete the last typed word. When typing in the browser it sometimes happens to me that I press Ctrl-w out of a habit, resulting in the current tab being closed. –  Chiel92 Aug 28 at 7:57

It was absolutely "stolen" or "borrowed" from Mac OS. Windows originally used Alt+F4 to close windows, but they realized that was a sub-optimal (read: dumb) choice.

W was chosen because of its close proximity to Q which was the obvious choice for a [Q]uit keyboard shortcut.

Apple was very keen on having every piece of software either internally or by a third party follow a set of human interface guidelines. Included in these guidelines was this, among many other things. Microsoft and Windows were much more open to allowing developers to do whatever they chose, and ignoring many conventions, certainly around how keyboard shortcuts worked. I certainly remember a lot of early windows software that had unique cut/copy/paste shortcuts.

For instance, even in Windows 7 Notepad doesn't close with Ctrl+W, you have to use Alt+F4, or Alt, then F, then X.

Another example is the command prompt. Even in 2014, you can't copy and paste like a normal human being, you have to first mark an area of text and then use the enter key to copy it. Likewise to paste, you right click, because why make everything the same? That's boring...

This is the oldest copy I could find of Apple's Human Interface Guidelines. On page 102 it says this:

The Close command closes the active window, which may be a document window, a modeless dialog box, a folder, or any other type of window. Clicking in a window’s close box provides a mouse-based method of closing windows. The user can also press Command-W to close windows.

While this copy of the HIG is from 1995, this convention was on the Mac before even this, perhaps as early as 1986.

There is even this internet gem talking about how Adobe products (on Windows) don't follow the convention used by Firefox:

I like the way Ctrl-W works in Firefox. It closes the current tab, but if there's only one tab open, it closes the whole Firefox window.

In Adobe products, Ctrl-W closes child windows but not the main program window.

Ctrl-W will close Explorer windows, but in many other programs, you have to use some other hotkey. I find myself trying to use Ctrl-W in other programs and getting frustrated when it doesn't work. I know about Alt-F4 but Ctrl-W is an easier combination to reach for.

Would it be possible to make a program that made Ctrl-W always work the way it does in Firefox? That is, no matter what program you were in, Ctrl-W would first close active child windows or tabs, then it would close the main program window. If the program only had one window, it would close that window.

Also, and this part would be optional, would it be possible for this program to:

-detect if the active program has ascribed a different use for Ctrl-W -if the active program uses Ctrl-W for something different, pop up a dialog box asking if you want to override the Ctrl-W behavior for this program from now on (in other words, this would allow the Universal Ctrl-W program to update a "override" and "exceptions" list)?

I hope this sounds useful to other people...

The answers suggesting AutoHotKey and the like are to a Mac user laughingly complex and unnecessary.

There's this as well

share|improve this answer
14  
Alt+F4 is still the standard keyboard shortcut for closing a window on Windows (or rather, closing [the window of] the focused application), being associated with the "Close" item in the window menu common to most/all windowed applications on Windows (the one you get by left-clicking the far left region of the title bar, right-clicking anywhere in the title bar, or pressing Alt+Space). And even if the Windows console did have non-mouse copy-paste functionality, the bindings would be nonstandard as Ctrl+C already has historic meaning. –  JAB Feb 26 at 18:32
2  
Found the Macintosh User's Guide for Macintosh PowerBook 160 and 180 computers from 1992 which shows the Close Window Cmd-W shortcut on PDF page 62 (labeled 46). –  Daniel Beck Feb 26 at 18:47
7  
CTRL-W is implemented at the application level, by the application authors (Microsoft or otherwise). Alt-F4 is "Quit program" on Windows (at the OS level). One is not a replacement for the other. Windows KB shortcuts: support.microsoft.com/kb/126449 –  Ƭᴇcʜιᴇ007 Feb 26 at 19:22
2  
Ctrl-C was already taken for the Command Prompt (it means break), so using the standard Ctrl-X/C/V would not work without breaking many command line programs. The Command Prompt is a special window (terminal emulator) and must take care to not hide keys that may be needed or responded to by the software running in the terminal, whether remote UNIX/VMS or local MS-DOS legacy apps. For example, if you are running a command line program that responds to Ctrl-W, having it close the Command Prompt would be infuriating. –  Maxx Daymon Feb 26 at 23:42
13  
-1 - this basically reads like a rant and then goes off into totally irrelevant territory for the question. The usage between applications is consistent by the way. Alt+F4 closes the whole application, Ctrl+W closes the window (or document) of the application. The only inconsistency is that some applications terminate after the last window is closed, some do not. As for if it is stolen from Apple or not; I suspect nobody will ever know for sure. –  Mark Henderson Feb 27 at 3:01

It was stolen from the MacOS, which uses Command-w to close the current tab (for applications with tabs) or the current window. Note that Command-q is used to quit the application, so Command-w, which is one key over, probably seemed like a good choice to close a window.

share|improve this answer
15  
I find this not plausible. Do you have any sources to support your words? –  bazzilic Feb 26 at 11:27
4  
I can personally testify that Command-W was commonly used on Macs to close application/document windows 15-20 years ago ... which of course does not mean those conventions originated on the Mac. As a note, Ctrl-C for copy, Ctrl-X for cut, and Ctrl-V for paste also came from the Mac (although the Mac modifier was Command rather than Control); the dominant PC convention until roughly the mid-90's was Ctrl-Insert for copy, Shift-Insert for paste, and Shift-Insert for cut. –  David Feb 26 at 13:45
4  
... I remember reading that the choice of C/X/V for copy/cut/paste was deliberate. C for copy is an obvious mnemonic (at least if you're an English speaker), and X and V are adjacent to C (on QWERTY keyboards), plus X sort of resembles a pair of scissors. That would lend credence to the choice of W because of its proximity to Q. –  David Feb 26 at 13:53
6  
I can attest that command-w was used on macs to close the current window back before there was MS windows. "Stolen" might be a strong word, but certainly it's true that windows liberally borrowed from MacOS. –  Dan Pritts Feb 26 at 17:43
3  
I would be very surprised if these do not both date back to earlier OSs. Anyway, using the same shortcut is not "stealing", it is providing a consistent user experience and I wish all OSs did more of that. –  terdon Feb 26 at 19:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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