Leser: 1
3 Einträge, 1 Seite |
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/perl -w
use IO::Socket;
use Fcntl;
use strict;
use LCDd;
# Connect to the server...
my ($remote) = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "13666")
|| die "Cannot connect to LCDproc port\n";
# Make sure our messages get there right away
$remote->autoflush(1);
# Give server plenty of time to notice us...
sleep 1;
print $remote "hello\n";
# Turn off blocking mode...
fcntl($remote, F_SETFL, O_NONBLOCK);
# Set up some screen widgets...
print $remote "client_set name {ronny}\n";
print $remote "screen_add screen\n";
print $remote "screen_set screen -name {screen}\n";
print $remote "screen_set screen -heartbeat {off}\n"; #don't work, why???
print $remote "menu_add_item \"\" mymenu menu {jukebox}\n";
print $remote "menu_add_item mymenu sub_techno menu {Techno}\n";
print $remote "menu_add_item sub_techno action_favourite_techno action {Favourite} \n";
print $remote "menu_add_item sub_techno action_all_techno action {all}\n";
print $remote "menu_set_item sub_techno action_favourite_techno -menu_result {close}\n";
print $remote "menu_set_item sub_techno action_all_techno -menu_result {close}\n";
sub handleinput {
my $input = @_;
if ($input =~ /^menuevent (.*?) (.*)$/) {
menuevent($1, $2);
}
return;
}
sub menuevent
{
#menustates
my ($event, $id) = @_;
#print "Event: $event, id: $id\n";
if ($id eq "action_favourite_techno")
{
#test1
system("xmms");
}
elsif ($id eq "action_all_techno")
{
system("yast");
}
else
{
system("xmms");
print "huh? Unknown menuid: $id , and event: $event.\n";
}
}
while(1)
{
print $remote "menu_goto mymenu\n";
sleep 1;
handleinput();
}
close ($remote) || die "close: $!";
#EOF
3 Einträge, 1 Seite |