Added some hexadecimal display capabilities to aclox ascii clock
[mirrors/Programs.git] / perl / grfkill / thread-rfkill-applet.pl
... / ...
CommitLineData
1#!/usr/bin/env perl
2#RFKill-Applet (Harvie 2oo9)
3
4use strict;
5use threads;
6use Gtk2 -init;
7
8my $rfkill = '/sys/class/rfkill/rfkill*/state';
9#my $rfkill = '/sys/devices/*/*/*/rfkill/rfkill*/state';
10my $icon_e = 'gnome-dev-wavelan'; #enabled
11my $icon_d = 'emblem-unreadable'; #disabled
12
13my $statusicon = Gtk2::StatusIcon->new();
14#$statusicon->signal_connect(activate => sub { Gtk2->main_quit; }); #exit on click...
15
16my $state = -1;
17if(fork()) {
18 Gtk2->main;
19} else {
20#my $thr = threads->new(sub {
21 while(1) {
22 #sleep(1);
23 my $last = $state;
24 $state = `head -c 1 $rfkill 2> /dev/null`;
25 if($state != $last) {
26 if($state >= 1) {
27 $statusicon->set_from_icon_name($icon_e);
28 $statusicon->set_tooltip_text('Radio enabled');
29 } else {
30 $statusicon->set_from_icon_name($icon_d);
31 $statusicon->set_tooltip_text('Radio disabled');
32 }
33 }
34 }
35#});
36}
37
38print "RRR";
39
40
This page took 0.314184 seconds and 4 git commands to generate.