- Close All Windows at Once — Safely & Easily Quit Apps Before Shutting Down Your PC
- Command Line Usage
- How to close all applications in a workspace?
- 1 Answer 1
- Script to close all application windows on a specific workspace in Gnome
- The script
- How to use
- Explanation
- How can I make a shortcut to close all the windows of the same application?
- 4 Answers 4
- How to safely close all windows of a gui application with a shortcut key
- Explanation
- How can I close all opening windows with a script?
- 3 Answers 3
- How to close all open windows at once?
- 12 Answers 12
Close All Windows at Once — Safely & Easily Quit Apps Before Shutting Down Your PC
Close All Windows (or CloseAll) is an ultimate task management tool for Windows designed specifically to quickly close multiple applications. CloseAll flashes a ‘close’ signal to the selected applications and then ceases. It doesn’t use any system resources at all, since you run it only when needed. What can be easier than a task list with check boxes and OK button? Yes, you can run CloseAll without any UI too!
Pay once, use forever on any PC you own!
BLACK FRIDAY SALE: 35% off this week only!
CloseAll allows you to choose different sorting and grouping options for the task list, double-click groups to select/deselect the whole group, filter apps by typing in any part of their window title or app name, and use individual close buttons to close apps one by one.
Screenshots created with WinSnap – 20% discount if bought together with CloseAll!
New dark theme is default now:
Start typing to search for apps quickly:
Command Line Usage
You can specify /NOUI command line switch to run CloseAll in silent mode and close all windows without any UI interaction. Just open CloseAll shortcut properties and add /NOUI to the “Target” location:
CloseAll is indeed very handy if you are running
20 applications at the same time and want all of them to quit instantly. Try it now to see if it saves you time!
Pay once, use forever on any PC you own!
BLACK FRIDAY SALE: 35% off this week only!
CloseAll runs only on Windows 10, 8, 7 and Vista (32-bit and 64-bit). The native 64-bit version is included in the setup package and installed automatically.
Never miss when a new version comes out! Subscribe to updates →
How to close all applications in a workspace?
Is there a gnome 3 extension or a fedora 25 shortcut to close all opened applications in a workspace? (Closing the workspace itself by pressing an X for example).
I’ve seen that functionality somewhere long time ago, forgot where, but it’s not available in fedora by default.
1 Answer 1
The answer below was written and tested on Gnome3 / Ubuntu. Please mention if you run into issues when running it on Fedora / Gnome.
Script to close all application windows on a specific workspace in Gnome
The script below will close all windows on a specific workspace, with two options:
When run without arguments, it closes all windows on the current workspace, e.g.:
when run with a specific workspace as argument, it will close all windows on that workspace, e.g.:
will close all applications on workspace 1. Note that the first workspace has index 0
The script
How to use
- The script needs wmctrl, which should be installed if it isn’t on your system.
- Copy the script into an empty file, save it as close_wins.py
Now test- rune the script from a terminal window, with the targeted workspace as argument, e.g.:
to gracefully close all windows on workspace 3 (0 = worspace 1)
To close all windows on the current workspace, run it without arguments:
If all works fine, add it to a shortcut key: choose: System Settings > «Keyboard» > «Shortcuts» > «Custom Shortcuts». Click the «+» and add the command:
. or run it in any other way you’d prefer.
Explanation
The command wmctrl -lG will give us information on the currently opened windows. The output looks like:
From the second column, we can retrieve the window’s location:
The 2 means the window is on workspace 3, since 0 refers to the first workspace.
If the script runs with the workspace as argument, the script parses out the corresponding window- id’s and subsequently closes them gracefully with the command (e.g.):
If the script runs without the workspace as argument, the script retrieves the current workspace from the command:
and subsequently uses the current workspace internally as argument.
How can I make a shortcut to close all the windows of the same application?
When I right click on an application’s icon in the Unity launcher, I can press Quit to close all the windows corresponding to that application. Is it possible to do the same with a keyboard shortcut which operates on the active window (and all the other windows corresponding to the same application)?
I could do something similar with xkill , but in that case I do not have the message that remembers me of unsaved files.
4 Answers 4
The answer by user72216 didn’t work always. For example if I opened several Okular (a KDE PDF viewer) windows, the code won’t close all windows, as different window ids are assigned to the windows. The following code extracts all window ids and closes them gracefully:
How to safely close all windows of a gui application with a shortcut key
The safest way to close an application’s window gracefully, and make sure you will not lose data, is using wmctrl (not installed by default):
To use it in a script to close all windows of an application:
install both xdotool and wmctrl
Copy the script below into an empty file, save it as stop_active.py
Add the following command to a shortcut key:
Choose: System Settings > «Keyboard» > «Shortcuts» > «Custom Shortcuts». Click the «+» and add the command:
N.B. don’t use
or $HOME in a shortcut key, but use absolute paths instead.
Now the shortcut can be used to gracefully close all windows of the frontmost window.
Explanation
I tried the various kill options ( kill -2 , kill -HUP , kill -s TERM
etc), which are mentioned in several posts to close an application gracefully. Tested on a gedit window with unsaved changes, all of them closed the window happily however, without any interaction.
wmctrl does ask what to do however, similar to Ctrl + Q .
The script then first finds out the pid of the frontmost window, with the command:
subsequently, the list of currently opened windows is called with the command:
From this list, the corresponding windows are picked and closed with the command:
If you are closing all nautilus windows, in the line
«Desktop» is referring to your Desktop window, which normally should always stay. If you are not using an English version of Ubuntu, replace «Desktop» by the localized name of the Desktop in your language.
How can I close all opening windows with a script?
I want to close all opening windows by executing a shell script (just like open multiple applications by executing a script) but I don’t know how. How can I achieve this?
3 Answers 3
You might want to use wmctrl -c . If you’re trying to close gedit for example, it will ask you if you want to save unsaved files.
Difficult problem, but I tricked it 🙂 I searched a lot in the web and I resulted to a solution.
The following bash script, initially, reads all the open windows’ IDs, then, it converts every of the IDs to process PIDs. Finally, it converts all the PIDs to process-names. It outputs both the PIDs and the process-names.
Here is the script:
The output of this script on my machine, with ettercap-gtk open, chromium, 2 gnome-terminal windows and gedit, the output is:
As you can see, not only the open windows are being outputed, but also everything GUI-like, like nm-applet. So, if I were you, I would grep out every process that is obvious it shouldn’t be killed, and then I would killall everything else!
You can also again ‘uniq’ so as to not kill duplicate things.
Inspired by the answer given by user55822, I have made a script specifically to be used in the Xfce Desktop Environment, but it could be adapted to be used on any desktop using a window manager that interacts properly with wmctrl.
My script takes the extra step to wait until all the windows are actually closed so that if called from another script it won’t return too soon. Here is my script for closing all the open windows other than panels and the Desktop itself:
To adapt it for a desktop other than Xfce, you would need to replace grep -vwE «Desktop$|xfce4-panel$» with whatever works on that desktop. What that part of the script is doing is narrowing down the results of wmctrl -l to not include anything ending in the word «Desktop» or «xfce4-panel». So to adapt it, you would just run wmctrl -l and look for what’s at the end of the lines for windows you want to stay open. On Xfce at least, it ends up listing the Desktop itself as a window so that without the grep command, it ends up logging out of Xfce.
How to close all open windows at once?
How do I close all opened windows at once?
12 Answers 12
All answers I could quickly find on this topic involve either the tip Molly gave or using an application (or coding it yourself). For example (I haven’t tried this), Close All Windows.
Also, by pressing Ctrl + Shift + Esc you get the Windows Task Manager, where you can see all running applications at once (among other things), select them, and End Task them.
I like to see my open windows ungrouped, but realized that this i.e. closing multiple windows at once was a problem with such a setting. A less time-taking method would be to use the command line like this :
And then restart explorer using :
Caution : This will cause processes like file copying on the default Windows interface to abort.
Simultaneously close all open windows:
- While pressing the Ctrl key, successively click each of the task icons on the taskbar.
- Right-click the last task icon, and choose Close Group.
If you only want to minimize the windows, use the ‘Show Desktop’ shorcut.
I usually (yes, this happens a lot to me..) just press Alt key and then go crazy on the F4 key until everything is shut down. Not one click, but it’s pretty fast. Or, depending on your system, reboot.. Don’t forget to save anything.
Or maybe you could simply switch users to continue your work without all these tabs. Then when you’re down, shutting down the computer will kill all the processes for the first user.
Not the best solutions, I just thought Id give this one a try.
It’s not a one-click solution but it is the fastest I know with my Windows 7 Pro
- Open taskbar properties (right click > properties) or (Control Panel > Appearance and Personalization > Taskbar and Start Menu)
- Select «Group similar taskbar buttons» = «Group similar taskbar buttons», and click OK
- Your windows are group, right-click and select «Close all windows»
- Go back to taskbar properties to restore you old settings
After doing Ctrl-Shift-Esc, go to applications. Then, press shift down and end task, all of them will end (You might get a confirmation message or something depending on the program).
Sometimes, even when you close a program, the processes of the program (The biggest example is an unclosed connection to a local file) may still be on your computer. Most of the time, these processes are mainly overlooked by the owner software because they use almost no space. However, if you still want to end them, just to be meticulous, go to processes and you’ll have to end them one by one.