From: Simon Ruderich Date: Tue, 7 Jun 2011 16:08:08 +0000 (+0200) Subject: bin/battery.pl: Add tmux mode. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=ebdf67298438e5c29550f6e3020b0b313ad50777;p=config%2Fdotfiles.git bin/battery.pl: Add tmux mode. --- diff --git a/bin/battery.pl b/bin/battery.pl index 31501ac..6a9ce2c 100755 --- a/bin/battery.pl +++ b/bin/battery.pl @@ -13,6 +13,7 @@ if (! -e $path) { } my $screen_mode = (defined $ARGV[0] and $ARGV[0] eq '-s'); +my $tmux_mode = (defined $ARGV[0] and $ARGV[0] eq '-t'); my %battery; @@ -37,6 +38,18 @@ if ($screen_mode) { } print "\005{+$color}$charge%\005{-}\n"; +# Same in tmux mode. +} elsif ($tmux_mode) { + my $color; + if ($charge < 20) { + $color = 'red'; + } elsif ($charge < 40) { + $color = 'yellow'; + } else { + $color = 'green'; + } + + print "#[fg=$color,bold]$charge%#[default]\n"; # Just text output. } else {