Posted on 2006-09-06 03:35:45-07 by mvdde
problem with the get_window function
I found (what I think is) a problem in X11::WMCtrl. The function get_windows was returning the hostname and window name in the title field. I believe this was caused because my version of the wmctrl program was returning two spaces between the ID and hostname, for example:
x0340007a 0 simon My Yahoo! - Mozilla Firefox
I re-wrote the get_windows function to take this into account:

sub get_windows { my $self = shift; my $data = $self->wmctrl('-l'); my @windows; foreach my $line (split(/\n/, $data)) { if($line =~ /^([^ ]*) *([^ ]*) *([^ ]*) *(.*)/) { push(@windows, { id => $1, workspace => $2, host => $3, title => $4, }); } } return @windows; }
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.