[Xmonad] State information,
workspace names and "emptyness" indicator
Robert Manea
rob.manea at googlemail.com
Mon Jun 4 09:05:27 EDT 2007
Hi,
below you'll find a _rather hackish_ approach to display state information
with xmonad. See the comments in the script to get it running.
Here is a shot how it could look like, note the upper left corner:
http://omploader.org/file/xmonad-dzen-state-wsnames.png
Script and instructions:
#!/usr/bin/perl
# statedump.pl - beware, hackish solution
#
# (c) 2007 by Robert Manea <rob dot manea at gmail dot com>
# dump xmonad state in a readable format
#
# Usage:
# ------
# Uncomment the line reading "withWindowSet (io . hPrint stderr)"
# in xmonad's Operations.hs. This will enable a state dump.
#
# start xmonad like this:
# xmonad 2>&1 | statedump.pl | dzen2 -w 300 -ta l
#
# Workspaces containing windows have an * prefix
# the current workspace is enclosed in [ ]
#
use strict;
use warnings;
#----------------------------------------------------------------------
# set the names of the workspaces
# if no name is set, the workspace
# number will be displayed
my %ws2name = (
0 => "dev",
1 => "mail",
2 => "web",
3 => "comm",
4 => "ham",
5 => "tmp"
);
#----------------------------------------------------------------------
my $fr=0;
$|=1;
while(<>) {
my @s = split /Workspace/;
$s[1] =~ /tag\s=\s+W\s([0-9]),/;
my $cws = $1;
for(sort @s) {
my @f = /{tag\s=\s+W\s([0-9]),.*stack\s=\s+(.*)/;
my $ws = $f[0]; my $emp = $f[1];
$fr++;
if($fr < @s) {
print "*" if($emp !~ /Empty/);
if($ws eq $cws) {
$ws2name{"$cws"} ? print '[', $ws2name{"$cws"}, '] ' : print '[', $cws+1, '] ';
} else {
$ws2name{"$ws"} ? print $ws2name{"$ws"}, ' ' : print $ws+1, ' ';
}
}
}
$fr=0;
print "\n";
}
__END
Bye, Rob.
More information about the Xmonad
mailing list