Xfce Forum

Sub domains
 

You are not logged in.

#1 2011-12-07 10:40:28

xulops
Member
Registered: 2011-12-06
Posts: 7

Minimize windows only on active workspace

Hello, 

With multiples windows on multiples workspaces, a click on "hide windows and show desktop" applet (in french : "Réduire toutes les fenêtres et afficher le bureau"), hide all windows on all wokspaces.
Is it possible to make this applet only minimize windows on the active workspace ?

Cheers

Offline

#2 2011-12-07 11:44:38

Nick
Dev
From: ~
Registered: 2005-02-17
Posts: 1,144
Website

Re: Minimize windows only on active workspace

No, it is a screen property (_NET_SHOWING_DESKTOP) that is emitted, not a per-workspace setting.

Offline

#3 2011-12-07 12:13:55

xulops
Member
Registered: 2011-12-06
Posts: 7

Re: Minimize windows only on active workspace

Thanks for your answer.

Maybee there is a way with wmctrl ?
http://tomas.styblo.name/wmctrl/

But it's probably more complicated than i thought.

Offline

#4 2011-12-12 13:54:49

xulops
Member
Registered: 2011-12-06
Posts: 7

Re: Minimize windows only on active workspace

Hello,
I code a (dirty) workaround : a script using wmctrl and xdotool.
Here is a PHP script, but it could be a perl or python...

<?
// active desktop
$result = shell_exec("wmctrl -d");
$t = explode("\n", $result);

$active_desktop = "";
foreach ($t as $l) {
	$tl = explode(" ", $l);
	if ($tl[2] == "*") {
		$active_desktop = (int) $tl[0];
		break;
	}
}

if ($active_desktop != "") {
	// search for window on this desktop
	$result = shell_exec("wmctrl -l");
	$t = explode("\n", $result);
	foreach ($t as $l) {
		$id = substr($l, 0, 10);
		$desktop = (int) trim(substr($l, 10, 3));
		if ($desktop == $active_desktop) {
			// minimize window
			$result = shell_exec("xdotool key $id alt+F9");
		}
	}
}
?>

Offline

#5 2011-12-28 10:55:31

semik
Member
Registered: 2011-12-28
Posts: 1

Re: Minimize windows only on active workspace

Hello,

xulops script works great, only line:

xulops wrote:

$result = shell_exec("xdotool key $id alt+F9");

should be replaced by:

$result = shell_exec("xdotool windowminimize $id");

Regards,
Martin

Offline

#6 2011-12-28 18:38:16

xulops
Member
Registered: 2011-12-06
Posts: 7

Re: Minimize windows only on active workspace

Thanks Semik, i'll test that.

Just another bug : in PHP $active_desktop = "" and $active_desktop = 0 is the same thing and could cause trouble one the first workspace (id 0).
$active_desktop must be initialized with another value (-1 for example) and the if must become if ($active_desktop > -1) < ...

Offline

Board footer

Powered by FluxBB