Minimize all or single opened application window(s) [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

Minimize all or single opened application window(s) [SOLVED]

#1 Post by Argolance »

Hello,
Is it possible and if yes, how to minimize all opened application windows to the task bar using a command line?
Thank you.

Cordialement.
Last edited by Argolance on Mon 21 Jan 2013, 14:56, edited 1 time in total.

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

#2 Post by amigo »

wmctrl is the tool -can't remember the options right now.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#3 Post by SFR »

Here you go.

Minimize all windows:

Code: Select all

for i in `wmctrl -l | cut -f1 -d ' '`; do wmctrl -i -r $i -b add,hidden; done
Unminimize:

Code: Select all

for i in `wmctrl -l | cut -f1 -d ' '`; do wmctrl -i -r $i -b remove,hidden; done
More:

Code: Select all

wmctrl --help
I've seen some packages in PET'n'Stuff section.
Too bad it's not OOTB in Puppies - it's small yet very powerful...

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#4 Post by seaside »

You can also use xdotool-

Code: Select all

for i in $(xdotool search ".*");do xdotool windowminimize $i;done
Available here- http://www.murga-linux.com/puppy/viewtopic.php?t=79573

Cheers,
s

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

#5 Post by amigo »

sfr, I am quite sure there is a wmctrl option which minimizes all windows at once, without the need for running it multiple times.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#6 Post by SFR »

Amigo, yes - I checked it out again and most likely it's:
wmctrl -k on
however it doesn't work in JWM, though eg. Openbox is fine...

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#7 Post by Argolance »

Hello,
Thank you for answering.
This is exactly what I was expecting for, though I had to install wmctrl using PPM because it is not present on Puppy Precise 5.4.3.

May I ask a supplementary question, so this will be quite perfect and duly [SOLVED] 8):
How to minimize a single window? I noticed this command line running wmctrl --help, to close the window "gracefully":

Code: Select all

 wmctrl -c <WIN>.
I presume <WIN> is something like the window ID? I would like to know how to get it?

Cordialement.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#8 Post by SFR »

Argolance wrote:How to minimize a single window? I noticed this command line running wmctrl --help, to close the window "gracefully":

Code: Select all

 wmctrl -c <WIN>.
I presume <WIN> is something like the window ID? I would like to know how to get it?
That one simply closes a window, not minimizes it.

To get names and IDs of opened windows:

Code: Select all

wmctrl -l
Minimize a window by its name:

Code: Select all

wmctrl -r window_name -b add,hidden
Same thing, but by its ID:

Code: Select all

wmctrl -i -r window_ID -b add,hidden
IMHO it's better to use IDs, since if there's more than one window with the same name, only the first match will be considered.

Also, if you're planning more complex actions (eg. to simulate keystrokes, mouse) it's worth to follow Seaside's advice and play with xdotool too, since they (xdotool+wmctrl) complement each other in some extent.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#9 Post by Argolance »

Hello,
Great!
Thank you a lot.

Cordialement.

Post Reply