I know that if I get the sid through :
ps -ax | grep firefox
and use :
kill -9 "sid"
I will close all the windows of the program.
How can I close only one window of an application running through the terminal?
command linekillwindow-managerwmctrl
I know that if I get the sid through :
ps -ax | grep firefox
and use :
kill -9 "sid"
I will close all the windows of the program.
How can I close only one window of an application running through the terminal?
Best Answer
Probably the easiest option is using
wmctrl -c
. You might have to install it first:then to close a window named "example" (no matter what application it belongs to), use the command:
More options
However, there are many more options to close a specific window, depending on your "angle of incidence".
A few examples:
To close a specific window by clicking on it:
To close a specific window by its numeric id:
To close the active window:
To use the pid to get a list of windows, owned by a specific application (e.g. gedit):
then close the specific window
get.sh
by either:or:
If you know only part of the window name, e.g. there is a window;
monkey eats banana.txt
, you know it hasbanana
in its name,first bring the window to front:
then decide if you want to close the window (as active window for example)
options are numerous, see also man wmctrl. man wmctrl