Fixed CPU usage and memory for i3blocks
This commit is contained in:
@@ -29,7 +29,7 @@ GetOptions("help|h" => \&help,
|
||||
|
||||
# Get CPU usage
|
||||
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
|
||||
open (MPSTAT, 'mpstat 1 1 |') or die;
|
||||
open (MPSTAT, 'mpstat |') or die;
|
||||
while (<MPSTAT>) {
|
||||
if (/^.*\s+(\d+\.\d+)\s+$/) {
|
||||
$cpu_usage = 100 - $1; # 100% - %idle
|
||||
|
||||
@@ -40,7 +40,7 @@ END {
|
||||
if (type == "swap")
|
||||
printf("%.1fG\n", (swap_total-swap_free)/1024/1024)
|
||||
else
|
||||
printf("%.1fG\n", mem_free/1024/1024)
|
||||
printf("%.1fG\n", (mem_total-mem_free)/1024/1024)
|
||||
|
||||
# TODO: short text
|
||||
|
||||
|
||||
@@ -39,29 +39,27 @@ command=date '+%H:%M.%a-%m-%d'
|
||||
interval=30
|
||||
color=#cccccc
|
||||
|
||||
[wifi]
|
||||
label=
|
||||
instance=wlp3s0
|
||||
interval=10
|
||||
|
||||
[battery]
|
||||
label=
|
||||
interval=10
|
||||
# [wifi]
|
||||
# label=
|
||||
# instance=wlp3s0
|
||||
# interval=10
|
||||
|
||||
# unbold this?
|
||||
[load_average]
|
||||
# [load_average]
|
||||
# label=
|
||||
# interval=5
|
||||
# color=#990000
|
||||
|
||||
# [cpu_usage -w 50 -c 80]
|
||||
[cpu_usage]
|
||||
label=
|
||||
interval=5
|
||||
color=#990000
|
||||
interval=5
|
||||
|
||||
[memory]
|
||||
label=
|
||||
color=#006600
|
||||
|
||||
[cpu_usage -w 50 -c 80]
|
||||
label=
|
||||
min_width=CPU: 100.00%
|
||||
color=#adeaea
|
||||
color=#addfe3
|
||||
interval=5
|
||||
|
||||
[name]
|
||||
label=
|
||||
|
||||
Reference in New Issue
Block a user