Here is a modification to Kim's script that iconifies only non-sticky windows. WFM but use at own risk though.

Amit

--------------------------

#!/usr/bin/perl

# Get the current desk
open(FD, "eesh -ewait 'goto_desktop ?'|");
while(<FD>) {
if (/Desktop: (\d+)/) {
$CD = $1;
}
}
close(FD);

# Get the current area
open(FD, "eesh -ewait 'goto_area ?'|");
while(<FD>) {
if (/Area: (\d+ \d+)/) {
$CA = $1;
}
}
close(FD);
#print "Desk/Area: $CD/$CA\n";

# Find the ones on this desk(/area)
open(FD, "eesh -ewait 'window_list long'|");
while(<FD>) {
if (/^ *(\w*) : (.+) :: (\d+) : (\d+ \d+)/) {
$Win  = $1;
$Name = $2;
$Desk = $3;
$Area = $4;
next unless "$Desk" eq "$CD";
# Erhhh.. problems with sticky ones
# next unless "$Area" eq "$CA";
# print "$Desk/$Area: $Win/$Name\n";
next if "$Name" =~ /^E-|gnome-panel/;
$wins = "$wins" . "$Win ";
}
}
close(FD);

# print "$wins";
@wlist = split / /,$wins;

# Iconify each window in list if it is not sticky
for (@wlist) {
   $win = $_;
   $cmd = "win_op $win stick ?";
#   print "$cmd\n";
   open(FD, "eesh -ewait '$cmd' |");
   while(<FD>) {
#   print "eesh reply = $_\n";
if (/^(\w*) (\w*): (\w+)/) {
$key1  = $1;
$key2 = $2;
$value = $3;
# print "key=$key2,value=$value\n";
next unless "$value" ne "yes";
$ops = "$ops" . "win_op $win iconify on\n";
}
    }
}
close(FD);
#print "Ops: $ops";
system("echo \"$ops\" | eesh");

Reply via email to