summaryrefslogtreecommitdiffstats
path: root/lib/network/signal_strength.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/network/signal_strength.pm')
-rw-r--r--lib/network/signal_strength.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/network/signal_strength.pm b/lib/network/signal_strength.pm
new file mode 100644
index 0000000..19e119c
--- /dev/null
+++ b/lib/network/signal_strength.pm
@@ -0,0 +1,14 @@
+package network::signal_strength;
+
+use common;
+use ugtk2;
+
+my %pixbufs;
+
+sub get_strength_icon {
+ my ($network) = @_;
+ my $approx = 20 + min(80, int($network->{signal_strength}/20)*20);
+ return $pixbufs{$approx} ||= ugtk2::gtkcreate_pixbuf('wifi-' . sprintf('%03d', $approx));
+}
+
+1;