aboutsummaryrefslogtreecommitdiff
path: root/.config/tmux/status-right.pl
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-02-23 12:12:44 +0100
committerPatrick Spek <p.spek@tyil.nl>2021-08-14 11:59:30 +0200
commit3dd93ef53990aca21af9ddac87e256c203b9bc8b (patch)
tree5278b98d896124c0a046034f7f63ff1d1da09384 /.config/tmux/status-right.pl
parent2c60338d0df21d0a3c5662f57b6ee97484f8ea57 (diff)
Add tmux conf
Diffstat (limited to '.config/tmux/status-right.pl')
-rwxr-xr-x.config/tmux/status-right.pl51
1 files changed, 51 insertions, 0 deletions
diff --git a/.config/tmux/status-right.pl b/.config/tmux/status-right.pl
new file mode 100755
index 0000000..23d6227
--- /dev/null
+++ b/.config/tmux/status-right.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+chomp(my $os = lc(`uname`));
+
+# define the subroutine for creating sections easely
+sub section
+{
+ my($color, $data) = @_;
+
+ return if $data eq '';
+
+ print "#[fg=colour$color] $data";
+ print "#[fg=colour8] ║";
+}
+
+# define the subroutines that generate the data
+sub battery
+{
+ chomp(my $output = `battery`);
+ $output =~ s/\n/ /g;
+ return $output;
+}
+
+sub inet
+{
+ my $device = "enp10s0";
+
+ chomp(my $output = `inet $device`);
+ return $output;
+}
+
+sub load
+{
+ chomp(my $output = `load`);
+ return $output;
+}
+
+sub mem
+{
+ chomp(my $output = `free -h | grep "Mem:" | awk '{print \$3}'`);
+ return $output;
+}
+
+# set the sections
+&section(12, &inet);
+&section(2, &load);
+&section(2, &mem);
+&section(11, &battery);