Depending upon the application and the layout of the menu in the application you may be able to press ALT + F followed by the X key. ALT + F opens the file menu and then X will exit the application. If this does not work look for a quit or exit button on the menu bar and press the corresponding underlined key. This should do the trick for you.
Answer from Mark S. on Stack ExchangeShortcut key to close window
Is there a keyboard shortcut to reliably closes the active window?
how can i close a window using the keyboard? I'v tried ctrl w. how can i maximize a page?
Shortcut key for closing windows? (not closing programs)
Videos
Depending upon the application and the layout of the menu in the application you may be able to press ALT + F followed by the X key. ALT + F opens the file menu and then X will exit the application. If this does not work look for a quit or exit button on the menu bar and press the corresponding underlined key. This should do the trick for you.
Yes, there is. It's Alt+F4.
This is the key combination to end a program. The only reason it doesn't work as advertised is ignorant programmers who refuse to follow Microsoft design guidelines.
This problem would persist with any other hotkey as well. You could only possibly create a custom solution with AutoHotKey (or similar tools) that kills the process. But this would most likely make you lose a lot of work. As that is quite the brute force method to exit a process.
I want to know more!
OK, to my understanding, there are several ways a Windows application can be terminated.
- Posting a
WM_CLOSEwindow message to the main application window. - Destroying the main application window.
- Terminating the process.
The first way is the clean way. The way you're intended to close an application. This is the same thing that Alt+F4 works. Pressing Alt+F4 will just send the WM_CLOSE message to the application window.
Now, let's look at all 3 ways in reverse order.
Terminating a process
In Windows, an application lives in a process. Inside that process, the application may create a window. The window is what you will see on your desktop and what you will interact with.
So, if the process is the root of an application, if you terminate it, everything else will go away as well. So this would be great to fully end an application. But this will kill the application so abruptly, that it will have no chance to save any critical data to disk.
So this would not be recommended!
Destroying the main application window
As we just learned, the main application window is just part of the process. So if we just destroy that window, we'll still have the process stinking up the place :(
And that would be even harder to get rid off than the application would have been.
This is most likely the nastiest approach to trying to end an application. Stay far away!
Posting a WM_CLOSE message
Windows is a message-based operating system. Meaning, components talk to each other by sending each other little messages.
One of these messages is the WM_CLOSE message.
If an application receives this message, it is agreed upon, that this application should seize all action and then life.
But every programmer can decide on his or her own how to handle the message.
As the documentation told us earlier, the default behavior would be to call DestroyWindow and, thus perform our application exit approach #2.
With the little difference that, this time, it's intentional and the program has every chance to save critical data.
Conclusion
So, as you can see, we're pretty much at the mercy of every programmer here. Or we take the risk of losing data (you don't want to take that risk!).
Essentially is there a way to configure a keyboard shortcut that is equivalent to clicking the "X" button in the titlebar of the currently active window?
I understand there's a semantic difference between closing a window or quitting an application, but in practice that's rarely applied consistently and it becomes a guessing game if it's CTRL+Q, CTRL+W, ESC … or nothing else at all.
wmctrl -c <win>
wmctrl - interact with a EWMH/NetWM compatible X Window Manager. -c <WIN> Close the window <WIN> gracefully.
(from man wmctrl. But note: I use XFCE so haven't tested this on Unity as found in default Ubuntu 16.04, and I wouldn't expect it to work if using Wayland on 17.10 upwards)
Had you try to use CTRL+Q
I was use to press these keys to close windows, never added a keyboard shortcut, seems to be the default at least in the distros I used(always debian based)
but I see the point of your question
Is there a shortcut key like ctrl + w on a mac for windows? And no, I'm not talking about alt + f4 that closes the whole program, just one that closes the selected window. I know there is ctrl + w which works for tabs in chrome but it doesn't seem to work for anything else.
Ideas?