Eigentlich könnte ich meinen Versuch auch zeigen, auch wenn es nicht funktioniert. Wenigstens geht das Auslesen der _NET_...-Propertys.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use strict;
use Tk;
use Tk::Xlib;
my $desktop_nr = shift; !defined $desktop_nr and die;
my $mw = new MainWindow;
$mw->withdraw;
sub _root_property {
my($prop) = @_;
my(undef, @vals) = eval {
$mw->property("get", "_NET_" . uc($prop), "root");
};
warn $@ if $@;
@vals;
}
for my $prop (qw(number_of_desktops current_desktop)) {
no strict 'refs';
*{$prop} = sub {
my($val) = _root_property($prop);
$val;
};
}
sub desktop_names {
my($names) = eval {
$mw->property("get", "_NET_DESKTOP_NAMES", "root");
};
warn $@ if $@;
split /\0/, $names;
}
print "Desktops: " . number_of_desktops() . "\n";
print "Names: " . join(" | ", desktop_names()) . "\n";
print "Active: " . current_desktop() . "\n";
my $root = $mw->Display->RootWindow;
# Hier scheitert es:
$mw->SendClientMessage('_NET_CURRENT_DESKTOP', $$root, 32, pack('LLxxxxxxxxxxxx',$desktop_nr,time()));
print "Active now: " . current_desktop() . "\n";
__END__