As the title says, Is there a shortcut to close all windows of the same application in gnome shell, or an extension to do this?
Thanks.
You can do the following command in terminal.
killall <application>
or press super key (windows/apple/ubuntu key) and type xkill. And click on the application you want to kill.
killall evince
closes all open pdf windows.
Commented
Nov 25, 2015 at 14:23
You may wanna test-ride the window-options-gnome-shell-extension from bitbucket.org, last updated Nov. 2012 (thus appears to be actively maintained).
... added option to close the current window (as opposed to the 'Quit' button that closes the entire application (i.e. all its windows)).
Enjoy!
ps:
Alternatively, you may (also) want to look into this SOLVED thread, which seems to offer yet another solution.
EDIT: "Quit from dash" is now an extension on the gnome extensions website.
Assuming you're using UNITY and its LAUNCHER, you can do so ("Close all windows of the same application") by selecting the target application in LAUNCHER and then using the right arrow
button to "Quit".
Here is a script which will close all windows of a certain application when you click on one of its windows (using killall
):
#! /usr/bin/env python
import sys,os, subprocess
# Function based on code from Apport
def get_window_pid():
xprop = subprocess.Popen(['xprop', '_NET_WM_PID'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out, err) = xprop.communicate()
if xprop.returncode == 0:
try:
return int(out.split()[-1])
except ValueError:
error_message(_('Cannot identify package'),
_('xprop failed to determine process ID of the window') + '\n\n' + err)
return -1
else:
error_message(_('Cannot identify package'),
_('xprop failed to determine process ID of the window') + '\n\n' + err)
return -1
def get_window_exe():
pid = get_window_pid()
if pid == -1:
return ''
return os.path.realpath('/proc/' + str(pid) + '/exe')
def close_all():
app = get_window_exe()
os.system('killall ' + app)
if __name__=='__main__':
close_all()
Save this to a file (such as closeall
), and make sure it is in the system path and is executable.
Then you can run it at any time by pressing Alt+F2 and typing closeall
.
xkill
suggested by Thomas Vanmellaerts. But I am looking for something like the 'Quit' option in unity launcher, thanks for your help.
Commented
Feb 28, 2013 at 18:27
xkill
can do that, though I'm not sure what the -all
option does.