blob: 23d622762ee956def0a3ce10e69440b3deedd9b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
§ion(12, &inet);
§ion(2, &load);
§ion(2, &mem);
§ion(11, &battery);
|