How to close all windows of a given program at once

How to do things, solutions, recipes, tutorials
Message
Author
some1
Posts: 117
Joined: Thu 17 Jan 2013, 11:07

#31 Post by some1 »

@amigo
Thank you

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#32 Post by Puppus Dogfellow »

amigo wrote:The filer does keep a per-window history which can be accessed by right-clicking on the filer window and choosing:
Window -> Previous (in a new or same window)

I long ago adapted the old patch mentioned earlier which adds a button to the toolbar to provide the 'Back' feature -but to the gtk-1.2 version of rox.

As I remember, the patch is not too hard to wrangle into the sources, but there is no way to 'patch' the already-compiled binary.
not sure about your machine, amigo, but on mine the right click gives Parent, not Previous.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#33 Post by amigo »

Ah, right you are -I hadn't looked at that patch for a long time.

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#34 Post by Puppus Dogfellow »

amigo wrote:Ah, right you are -I hadn't looked at that patch for a long time.
alas.

:(

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#35 Post by MochiMoppel »

I tinkered with the code lately and came up with a slightly improved version. See original post.
Attachments
Screenshot.png
(9.39 KiB) Downloaded 469 times

User avatar
TwoPuppies
Posts: 77
Joined: Wed 29 Dec 2010, 05:13
Location: Melbourne, Australia

#36 Post by TwoPuppies »

Thanks for a really useful thread.

Getting right back to the original post, is there a variant of this that will close ALL the windows on the current desktop, or ALL windows on ALL desktops? That is to say, not just ROX-Filer windows OR the windows of a specified application, but both at the same time.
[color=#006699]What you really need is two puppies:
Puppy Linux, and the sort with four legs and a tail.[/color]

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#37 Post by drunkjedi »

TwoPuppies wrote:Thanks for a really useful thread.

Getting right back to the original post, is there a variant of this that will close ALL the windows on the current desktop, or ALL windows on ALL desktops? That is to say, not just ROX-Filer windows OR the windows of a specified application, but both at the same time.
To close all programs and windows, and make your desktop clean just restart X.

User avatar
TwoPuppies
Posts: 77
Joined: Wed 29 Dec 2010, 05:13
Location: Melbourne, Australia

#38 Post by TwoPuppies »

drunkjedi wrote:To close all programs and windows, and make your desktop clean just restart X.
Yep. Knew that. I was just wondering if there was another form of the scripts / commands under discussion that did the same thing.
[color=#006699]What you really need is two puppies:
Puppy Linux, and the sort with four legs and a tail.[/color]

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#39 Post by tallboy »

Hi MochiMoppel.
I really don't have enough knowledge to comment code, so I may be totally wrong here, but isn't XKillClient something you could use?

http://linux.die.net/man/3/xkillclient

Here is an interesting question related to the problem:
http://stackoverflow.com/questions/3073 ... ents-child

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#40 Post by MochiMoppel »

drunkjedi wrote:To close all programs and windows, and make your desktop clean just restart X.
I take this as a joke :lol:
tallboy wrote:I may be totally wrong here, but isn't XKillClient something you could use?
Thanks for trying to help, but I don't see what this does and most of all: I don't have any problem :wink: .
TwoPuppies wrote:is there a variant of this that will close ALL the windows on the current desktop, or ALL windows on ALL desktops?
Well, yes, I once made several variants, some of them using Xdialog and some do what you are asking for, but I only published the "mild" version that you find here in this thread. Closing all windows is pretty radical and since I don't like cascading "Are you really sure?" dialogs I keep the potentially harmful stuff in my closet.

Nevertheless closing all windows can be very useful right before shutdown and I remember this thread where I - unsuccessfully - tried to convince other forum members that Puppy's usual shutdown process kills all windows instead of closing them and that this method can lead to data loss. For closing all windows on all desktops you can use something like this:

Code: Select all

WIN_ID=$(wmctrl -l | awk '{print $1}')
for i in $WIN_ID; do
	wmctrl -ic $i
done

User avatar
TwoPuppies
Posts: 77
Joined: Wed 29 Dec 2010, 05:13
Location: Melbourne, Australia

#41 Post by TwoPuppies »

MochiMoppel wrote:For closing all windows on all desktops you can use something like this:

Code: Select all

WIN_ID=$(wmctrl -l | awk '{print $1}')
for i in $WIN_ID; do
	wmctrl -ic $i
done
Excellent. Thank you.
[color=#006699]What you really need is two puppies:
Puppy Linux, and the sort with four legs and a tail.[/color]

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#42 Post by MochiMoppel »

User gychang requested here to close all minimized windows at once.

One way to do this:

Code: Select all

WIN_ID=$(wmctrl -l | awk '{print $1}') 
for i in $WIN_ID; do 
[[ $(xprop -id $i WM_STATE) = *Iconic* ]] && wmctrl -ic $i
done

User avatar
gychang
Posts: 414
Joined: Sat 29 Nov 2008, 20:30
Location: San Diego, CA

#43 Post by gychang »

MochiMoppel wrote:User gychang requested here to close all minimized windows at once.

One way to do this:

Code: Select all

WIN_ID=$(wmctrl -l | awk '{print $1}') 
for i in $WIN_ID; do 
[[ $(xprop -id $i WM_STATE) = *Iconic* ]] && wmctrl -ic $i
done
this script works well!
---
trying to learn puppylinux... :D
---

Post Reply