#!/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