6 sub heply
{ system "pod2text", $me; }
7 exit heply
if $ARGV[0] eq '--help';
10 sub bye
{ exit ReadMode
0 }
11 sub getkey
{ while(not defined ($k = ReadKey
(-1))){} return $k }
12 $SIG{INT
}=$SIG{STOP
}=$SIG{STOP
}=$SIG{TSTP
}=$SIG{QUIT
}='bye';
15 $awid = hex((`xprop -root -f _NET_ACTIVE_WINDOW 0x " \\\$0" _NET_ACTIVE_WINDOW` =~ /(\S+)$/)[0]);
19 for(split/[\r\n]+/,`wmctrl -lp`){
20 ($wid, $wrksp, $pid, $host, $title)=split/\s+/;
21 if(open(P
,"/proc/$pid/stat")) { ($state)=(<P
>=~/\
)\s
+(\S
+)/); close P
}
22 push @tl,[$wid, $wrksp, $pid, $_, $state];
23 $L = 2+length$_ if length$_ > $L; # set longest line
28 # sort order by workspace
29 @tl = sort { $$a[1] <=> $$b[1] } @tl;
30 # set selection if active window id match
31 if(tell STDERR
== 0) {
33 $in = $_ and last if hex $tl[$_][0] == $awid;
38 print STDERR
"\033[s\033[1;0H", ( ((" " x
$L) . "\n") x
($#tl+2) ), "\033[u";
43 print STDERR
"\033[s\033[1;0H";
45 printf STDERR
"%s%s\033[m\n",($_==$in?
"\033[44;1;36m":"\033[1;36m"),$tl[$_][3];
47 print STDERR
"\033[u";
50 if($k =~ /q/i) { bye
}
51 elsif($k eq chr(27)) {
55 if($k =~ /[DA]/) { # arrow left/up
58 elsif($k =~ /[CB]/) { # arrow right/down
61 elsif($k =~ /[H5]/) { # home/pg up
64 elsif($k =~ /[F6]/) { # end/pg down
67 elsif($k eq chr(27)) { bye
}
69 elsif($k eq chr(27)) { bye
}
72 system("wmctrl -ic ".$tl[$in][0]);
74 elsif($k =~ /[ts ]/i) {
75 kill ${$tl[$in]}[4] eq 'T' ?
18 : ${$tl[$in]}[4] eq 'S' ?
19 : 0, $$tl[$in][2] if $$tl[$in][2]; # CONT,TSTP
78 kill 9, $$tl[$in][2] if $$tl[$in][2]; # KILL
81 kill 1, $$tl[$in][2] if $$tl[$in][2]; # HUP
84 kill 2, $$tl[$in][2] if $$tl[$in][2]; # INT
88 print STDERR
"Commandline:\t";
89 open A
,"/proc/".${$tl[$in]}[2]."/cmdline";
90 print STDERR
join(" ",split/\x0/,<A
>)."\n";
92 print STDERR
"Directory:\t";
93 print STDERR
readlink "/proc/".${$tl[$in]}[2]."/cwd","\n";
95 open A
,"/proc/".${$tl[$in]}[2]."/status";
96 /^(ppid|uid|gid):/i and print STDERR
$_ while<A
>;
102 elsif($k =~ /[\r\n]/) {
104 system("wmctrl -ia ".$tl[$in][0]);
115 taslis - WM's Window List
119 B<Taslis> stands for I<tas>kI<lis>t. List X11 clients provided by wmctrl(1) in ANSI-compatible terminal.
131 Switch to workspace and raise window
135 Close window gracefully
139 Hangup selected process
147 Suspend, Resume process