chiark / gitweb /
Imported Upstream version 1.0.0
[e16] / sample-scripts / shade-pagers.pl
1 #!/usr/bin/perl
2
3 # Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors
4
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11
12 # The above copyright notice and this permission notice shall be included in
13 # all copies of the Software, its documentation and marketing & publicity
14 # materials, and acknowledgment shall be given in the documentation, materials
15 # and software packages that this Software was used.
16
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 # This is a hack of mandrake's "testroller.pl" that shades/unshades all your
25 # pager windows
26
27 # here we're going to test to see whether we are shading or unshading
28 # the window.
29
30 if($ARGV[0] eq "1") {
31     $shade = "on";
32 } elsif($ARGV[0] eq "0") {
33     $shade = "off";
34 } else {
35     $shade = "";
36 }
37
38
39 # make sure that we're not an internal window in our list
40
41 @winlist_temp = `eesh window_list`;
42 foreach(@winlist_temp) {
43     chomp;
44     @stuff = split /\s*\:\s*/;
45 #   print ">$stuff[0]<>$stuff[1]<\n";
46     if ($stuff[1] =~ /^Pager-.*/) {
47         push @winlist,$stuff[0] if ($stuff[0]);
48     }
49 }
50
51 # now we're going to walk through each of these windows and
52 # shade them
53
54 open IPCPIPE,"| eesh";
55 foreach $window (@winlist) {
56     print IPCPIPE "win_op $window shade $shade\n";
57 }
58 close IPCPIPE;
59
60 # Alternatively, simply do
61 #$ eesh wop Pager* shade [on|off]