23

Desktop application developers are free to choose which keyboard shortcuts they want to support. On Windows the convention is pretty strong:

  • Alt-F4 closes most applications
  • Ctrl-F4 closes most major sub-windows
  • Esc dismisses most dialogue boxes.

On Linux there hasn't been quite so much convergence, but the following are common:

  • Ctrl-q closes most applications
  • Ctrl-w closes most major sub-windows
  • Esc dismisses most dialogue boxes.

Unfortunately many applications have chosen to go their own way, either by using the Windows convention or by just doing their own thing:

  • Alt-F4 closes Chromium
  • Ctrl-Shift-q closes GNOME Shell
  • Alt-f x closes IDEA

To close sub-windows and dialogue boxes all bets are off. I've seen all of these in use:

  • Esc
  • Ctrl-F4
  • Ctrl-w

Some applications don't even have shortcuts for closing some windows (or at least none that I have been able to find).

Window managers have the power to override any of these, and can therefore be very helpful for keyboard users. Awesome WM is very keyboard-friendly, but are there global shortcuts to close any window and/or application in Awesome WM, and if not, how do I set them up?

l0b0
  • 50,672
  • 41
  • 197
  • 360
  • What's wrong with the little X on the title bar? That should be SIGTERM, meaning it will be no worse than any other external method; applications should catch this and shutdown just as they would via "quit" or whatever. In short: just close the main window and that should close the application. – goldilocks Feb 11 '13 at 10:44
  • 2
    @goldilocks That doesn't work in many WMs (like Awesome), and it's less efficient for someone used to keyboard navigation. – l0b0 Feb 11 '13 at 11:51
  • Doesn't sound very "awesome" to me, lol. I would strongly refute the assertion that "it doesn't work in many WMs" -- it certainly does work in virtually all of them, or they are plain and simple not serving their intended purpose. The most basic and fundamental thing: *you provide a window with a titlebar and a close button*. I agree point and click is less efficient than the keyboard, but que sera -- you are using a GUI -- and any *decent* WM will provide you with keybinding options to do stuff like this. Ie, you need to figure out how to create your own shortcuts. – goldilocks Feb 11 '13 at 12:09
  • 1
    Stack Exchange doesn't generally allow list questions, they're not a good fit for the way the site works (it's expected that you have a particular problem, somebody posts a solution and you accept it). If you find yourself saying "One ______ per answer", that's usually a bad sign – Michael Mrozek Feb 11 '13 at 15:16
  • 5
    @goldilocks: I think you misunderstand the purpose of awesome and [tilling window managers](http://en.wikipedia.org/wiki/Tiling_window_manager) in general. You *should* use them without touching the mouse at all. Most of them will not decorate windows at all which is a good thing(TM). – Sardathrion - against SE abuse Apr 16 '13 at 13:43
  • @Sardathrion Sorry for being hyperbolic; I'm aware of tiling WM's, and I prefer the keyboard to the mouse too. My point was that controlling windows is the domain of the window manager and not anything else; the question *as it originally appeared* revolved around the OP saying that since his WM (apparently) did not provide a means of doing basic things, then the "blame" for this lay with individual applications, or the OS -- wrong. If your WM lacks a feature you want or need, consider another WM, don't rail to the skies about how it's everything else which is flawed. – goldilocks Apr 16 '13 at 16:03
  • @goldilocks: Sorry, I did not mean to cause offence and I can see how my comment could be view as such. – Sardathrion - against SE abuse Apr 16 '13 at 18:07
  • @l0b0 You edited this and it got reopened months ago; I don't know why you're randomly replying to that ancient comment. I still don't understand what the issue is, honestly; Mod4+Shift+c kills the current X client (window), which is the same thing that happens on Windows. If you have a Windows program with multiple windows, Alt+F4 will close one of them, not the entire program. There is no Windows hotkey that closes an application, although Ctrl+q is fairly common, and I don't think there is one in Awesome. It might be possible to bind one, but I don't know Awesome well enough – Michael Mrozek May 28 '13 at 14:19
  • @MichaelMrozek Sorry, I replied because I generally assume out-of-date comments are deleted by their authors. Regarding Windows, if the main application window is focused Alt-F4 closes the application. I don't know of a single counterexample. – l0b0 May 28 '13 at 14:23

2 Answers2

21

From man awesome there doesn't seem to be a default key binding to close all windows of an application. It might be possible to manually add such a binding.

There is, however, a default key binding to close the one focused window*: Mod4-Shift-c. This will leave other windows (if any) of the application intact. It does not work for sub-windows ("logical" windows like tabs which are part of a single application window).

* Or "client" as it is known from the perspective of X as opposed to the user.

l0b0
  • 50,672
  • 41
  • 197
  • 360
  • 2
    Are you sure you don't have it backwards? `Mod4-Shift-c` should kill the current client. Closing a sub-window is application-dependent, the WM doesn't have anything to do with that – Michael Mrozek Feb 11 '13 at 17:51
  • Well, it works. For example, if you go into the Firefox preferences window and press it, it closes the preferences and not the application. Same with the search box in jEdit. So I think "Kill focused client" as it says in `man awesome` is misleading. – l0b0 Feb 12 '13 at 06:45
  • 2
    `Mod4-Shift-c` will close the currently focused window. If that is the last window of the application, it will close the application. The man page is correct. – Sardathrion - against SE abuse Apr 16 '13 at 13:39
  • @Sardathrion If you equate "client" with "window", yes. I guess that's WM developer parlance. – l0b0 Apr 16 '13 at 18:17
  • I took the liberty to edit the answer to clarify the concepts. – phunehehe May 28 '13 at 15:08
  • I confirm that Mod4(win key) + Shift + c will close pop ups in Firefox for instance, you keep the focus in the object you want to close, that's all. – devasia2112 Jul 23 '16 at 15:56
0

I've added the following to my clientbuttons table:

awful.button({ }, 2, function (c) c:kill() end)

Now my scroll wheel click closes the window.

AXE Labs
  • 265
  • 2
  • 3