Opened 15 years ago

Closed 14 years ago

#3898 closed enhancement (fixed)

Add a close tab menu item and shortcut

Reported by: axeld Owned by: jackburton
Priority: normal Milestone: R1
Component: Applications/Terminal Version: R1/pre-alpha1
Keywords: Cc: adamghill@…
Blocked By: Blocking:
Platform: All

Description

The current method of having a context menu over the tab is a bit hidden - why not have that entry in the menu as well? Also, there doesn't seem to be a way to close a terminal using a shortcut.

I think Command-W should close the tab not the window, as it does in other tabbed apps (like Firefox) - we have already Command-Q for this, anyway.

Attachments (1)

CloseActiveTabShortcut.patch (924 bytes ) - added by adparadox 15 years ago.
A patch to add Command-W as a keyboard shortcut to close the active tab.

Download all attachments as: .zip

Change History (15)

comment:1 by bonefish, 15 years ago

I find the Firefox behavior a bit annoying. Command-Q doesn't close the window, it quits the application (in case of Terminal it's the same). How about Command-Shift-W for closing tabs instead?

comment:2 by axeld, 15 years ago

It's not actually the same, as Terminal does not open more than one window. What you propose is the reverse of how Firefox handles this, btw. I don't care that much, but I would lean towards the Firefox solution, as that's something people are already familiar with as it's the common solution on other platforms.

in reply to:  2 comment:3 by bonefish, 15 years ago

Replying to axeld:

It's not actually the same, as Terminal does not open more than one window.

Hence closing the window and quitting the app is the same. :-)

What you propose is the reverse of how Firefox handles this, btw. I don't care that much, but I would lean towards the Firefox solution, as that's something people are already familiar with as it's the common solution on other platforms.

It's just somewhat inconsistent. In every other app Command-W closes the window, in Firefox it closes the tab. In Firefox Command-Shift-W closes the window, which it doesn't in any other app.

comment:4 by stippi, 15 years ago

Would be a nice subject for some field research... how many apps out there treat Command-W to close the current *document* regardless of whether it's in a window by itself or inside a tab? From a user's point of view, closing the document instead of literally the window is more convenient, no? Since otherwise you have two shortcuts for the same thing in a single window application. As far as Terminal goes, it's like Firefox from a user's point of view. You can have multiple windows, but inside each could be more than one "document". For consistency with true single window applications, I'd vote to let Command-W always mean to close the current document, not the current window.

comment:5 by bonefish, 15 years ago

You are mistaken -- Command-W is the system-wide shortcut to close a window. Be it a file panel, a settings window, or whatever window has a "close" button. That's why the Firefox behavior is irritating me (and I ran into that several times already) -- I want to close the window and therefore press Command-W. If Command-Shift-W would generally close a window, the Firefox behavior would be somewhat more consistent.

Since "other platforms" were mentioned: On Windows windows are closed with Alt-F4, Linux mimics that. MacOS X behaves the same way as Haiku, i.e. Command-W closes windows, save in Safari.

CU, Ingo

comment:6 by stippi, 15 years ago

I think I do get your point, it's a pragmatic approach, but I am not convinced yet. There are tons of examples where an action may have different "literal" meaning depending on context. Take for example the Escape key. It may mean to cancel a process, in other context it could mean to close a window. If you want to go to the extreme, even clicking with the mouse itself could serve as an example. It definitely depends on context what happens, or even on your following action. It could be "activate" or "grab and drag". I hope you don't think this argument is silly, I am just saying that your applied level or pragmatism is arbitrary. Command-W could simply also have a more flexible meaning than to literally close a window only. If it serves a sensible purpose and makes things more convenient, why not? My argument becomes even stronger when there is prior use in widespread applications, like certain popular tabbed browsers.

comment:7 by anevilyak, 15 years ago

OTOH, Firefox isn't consistent in its behavior across platforms either: for instance, on windows alt+f4 still closes the whole FF window, while ctrl+w closes a tab. At least last I checked.

in reply to:  7 comment:8 by bonefish, 15 years ago

Replying to anevilyak:

OTOH, Firefox isn't consistent in its behavior across platforms either: for instance, on windows alt+f4 still closes the whole FF window, while ctrl+w closes a tab. At least last I checked.

Yep, Control-Shift-W also closes the window. Which actually makes Firefox' behavior consistent across platforms. But that's exactly the problem -- I guess the Control-W shortcut originates from a platform where it didn't have any global meaning (supposedly Windows). On BeOS/Haiku it simply clashes with the pre-existing global "close window" shortcut. If I were a regular Windows user and if Firefox would override Alt-F4 to close tabs, I would argue just the same as now for Command-W under Haiku.

Regarding context-dependent meanings of shortcuts or actions in general, that is certainly true for a lot of actions, but there there are a few actions that are universally the same, like the cut, copy, paste, quit application, and close window shortcuts. Those are already established by the BWindow implementation for exactly that reason.

comment:9 by stippi, 15 years ago

Ok, let me try one more time, then I will shut up... The implementation of Command-W in the BWindow is of course also a convenience. For the vast amount of situations it will do exactly what the intention is, so it makes sense to implement it there already. Most interfaces/panels/windows shown by applications will be one "entity" you can close. BeOS was designed that one window was supposed to map to one document. Now we have multiple applications were the designers thought a single application window which holds multiple documents is also pretty convenient. So isn't it a logical consequence to "tweak" a default behavior/implementation in way that it still makes sense and offers the same convenience in the changed situation? If I have a single window app, Command-W could either still close the window and thereby the whole app, making it essentially useless, because that's what Command-Q already does, or I could tweak the default behavior, which was not designed to accomodate this situation, and offer the same thing semantically. It's only logical that I do it this way around, not the other way which would mean I drop single window applications completely and stick to the original intention of having one document per window. Designing interfaces and behavior in applications allows to think about what the user most likely meant to do. I realize the difference here is how you look at it: Command-W to you means strictly to close "a window" and that was your intention and you want it to do always this for consistency. My argument is simply that I find it more likely that the intention of the user is to close the document, whatever it is, not necessarily a window -- *if* we are in the respective context. And on top of that, Command-W would duplicate Command-Q anyways, and implementing it to close only the active document also means it's less destructive for a viewing application like a browser which doesn't (need to) ask you if you have unsaved changes. Same holds true for the Terminal, it has no mechanism to figure out if closing other tabs means something destructive.

comment:10 by jonas.kirilla, 15 years ago

I'm happy with Command-W closing merely one tab, and then the window when closing its last tab. Command-W closes single things and Command-Q closes everything. Maybe it helps if one sees tabs as merely stacked windows. I would hate to have a third shortcut to close tabs.

Perhaps tabbed applications could update the text in their menu option to say "Close tab" in the presence of multiple tabs, and "Close window" when there is only one tab.

If a distinction in keyboard shortcuts really has to be made for tabbed windows, I would say Shift-Alt-W should close the window with all its tabs. Its the odd case. Closing a tab is likely the common case. I don´t mind that it somewhat breaks the W == Window.

comment:11 by bonefish, 15 years ago

Stippi, I totally understand your interpretation of Command-W closing an entity. I just think it is a reinterpretation. For me Command-W has always been the convenient keyboard equivalent of clicking the window's close button. By now redefining its semantics this convenient universal shortcut is lost.

Regarding the argument that Control-W is useless in a single-window app: Firefox is not a single-window app. And why Terminal is multi launch (and thus single-window), I cannot say -- probably just for the additional challenge of still getting the window titles right. I don't think in general there's a good reason why applications with a tabbed interface should be single-window -- thinking of multi workspaces use I guess even the opposite is the case.

Anyway, if everyone else likes the modified Command-W behavior, I would at least suggest to introduce Command-Shift-W as the universal window close shortcut.

comment:12 by axeld, 15 years ago

In Mail, Command-Shift-W will close the window and keep the mail's status (ie. will leave it to "New").

I guess we could add that additional shortcut (as it can and may be overridden by apps), although I don't know if that will get much use. I would also like to add default shortcuts for minimizing/zooming.

by adparadox, 15 years ago

A patch to add Command-W as a keyboard shortcut to close the active tab.

comment:13 by adparadox, 15 years ago

Cc: adamghill@… added

comment:14 by jackburton, 14 years ago

Resolution: fixed
Status: newclosed

I went with COMMAND-SHIFT-W in hrev34176. If you liked COMMAND-W more, just shout (while I somewhat agree with stippi, I'm more inclined to give its own shortcut)

Note: See TracTickets for help on using tickets.