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?
3 Answers
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
-
1
-
13Note: it nearly universally closes the currently-active window across all programs. Feb 26, 2014 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).– AtheistFeb 27, 2014 at 10:51
-
1The 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.– chtenbAug 28, 2014 at 7:57
-
2Yeah, but it's not like VIM is known for being intuitive on any level... -- Point being: "But that's not what it does in VIM" is a universally bad UX argument (kind of by definition). -- OTOH, "That's what it's done in almost every Windows program for the last 20 years" holds a little more water... Dec 22, 2015 at 8:10
It was stolen from the Mac OS, 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.
-
19I find this not plausible. Do you have any sources to support your words?– bazzilicFeb 26, 2014 at 11:27
-
6I 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.– DavidFeb 26, 2014 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.– DavidFeb 26, 2014 at 13:53
-
6I 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. Feb 26, 2014 at 17:43
-
5I 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.– terdonFeb 26, 2014 at 19:53
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
-
17
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 pressingAlt+Space
). And even if the Windows console did have non-mouse copy-paste functionality, the bindings would be nonstandard asCtrl+C
already has historic meaning.– JABFeb 26, 2014 at 18:32 -
3Found 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, 2014 at 18:47 -
12CTRL-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 Feb 26, 2014 at 19:22
-
4Ctrl-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. Feb 26, 2014 at 23:42
-
23-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. Feb 27, 2014 at 3:01
Ctrl+Q
quits the browser altogether for most modern browsers andQ
andW
are right next to each other on QWERTY layouts.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.