Fixed CPU usage and memory for i3blocks
This commit is contained in:
@@ -139,7 +139,7 @@ function vsnp() { ni ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
|
|||||||
# applications {{{ #
|
# applications {{{ #
|
||||||
silent="> /dev/null 2>&1& "
|
silent="> /dev/null 2>&1& "
|
||||||
|
|
||||||
alias rg="ranger"
|
alias r="ranger"
|
||||||
alias mr="man ranger"
|
alias mr="man ranger"
|
||||||
# okular
|
# okular
|
||||||
# function ok() { nohup okular $1 > /dev/null 2>&1& ; }
|
# function ok() { nohup okular $1 > /dev/null 2>&1& ; }
|
||||||
@@ -165,7 +165,7 @@ alias h="htop"
|
|||||||
alias vbn="cvlc --loop --alsa-gain 1 ~/Music/brown-noise.mp3"
|
alias vbn="cvlc --loop --alsa-gain 1 ~/Music/brown-noise.mp3"
|
||||||
alias rmsw="rm .sw*"
|
alias rmsw="rm .sw*"
|
||||||
|
|
||||||
function rs(){ redshift -O $(echo "scale=2;$1*1000" | bc) ; }
|
function rs(){ redshift -P -O $(echo "scale=2;$1*1000" | bc) ; }
|
||||||
# function rds(){ redshift -O $1 ; }
|
# function rds(){ redshift -O $1 ; }
|
||||||
alias rx="redshift -x"
|
alias rx="redshift -x"
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ GetOptions("help|h" => \&help,
|
|||||||
|
|
||||||
# Get CPU usage
|
# 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
|
$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>) {
|
while (<MPSTAT>) {
|
||||||
if (/^.*\s+(\d+\.\d+)\s+$/) {
|
if (/^.*\s+(\d+\.\d+)\s+$/) {
|
||||||
$cpu_usage = 100 - $1; # 100% - %idle
|
$cpu_usage = 100 - $1; # 100% - %idle
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ END {
|
|||||||
if (type == "swap")
|
if (type == "swap")
|
||||||
printf("%.1fG\n", (swap_total-swap_free)/1024/1024)
|
printf("%.1fG\n", (swap_total-swap_free)/1024/1024)
|
||||||
else
|
else
|
||||||
printf("%.1fG\n", mem_free/1024/1024)
|
printf("%.1fG\n", (mem_total-mem_free)/1024/1024)
|
||||||
|
|
||||||
# TODO: short text
|
# TODO: short text
|
||||||
|
|
||||||
|
|||||||
@@ -39,29 +39,27 @@ command=date '+%H:%M.%a-%m-%d'
|
|||||||
interval=30
|
interval=30
|
||||||
color=#cccccc
|
color=#cccccc
|
||||||
|
|
||||||
[wifi]
|
# [wifi]
|
||||||
label=
|
# label=
|
||||||
instance=wlp3s0
|
# instance=wlp3s0
|
||||||
interval=10
|
# interval=10
|
||||||
|
|
||||||
[battery]
|
|
||||||
label=
|
|
||||||
interval=10
|
|
||||||
|
|
||||||
# unbold this?
|
# unbold this?
|
||||||
[load_average]
|
# [load_average]
|
||||||
|
# label=
|
||||||
|
# interval=5
|
||||||
|
# color=#990000
|
||||||
|
|
||||||
|
# [cpu_usage -w 50 -c 80]
|
||||||
|
[cpu_usage]
|
||||||
label=
|
label=
|
||||||
interval=5
|
|
||||||
color=#990000
|
color=#990000
|
||||||
|
interval=5
|
||||||
|
|
||||||
[memory]
|
[memory]
|
||||||
label=
|
label=
|
||||||
color=#006600
|
color=#addfe3
|
||||||
|
interval=5
|
||||||
[cpu_usage -w 50 -c 80]
|
|
||||||
label=
|
|
||||||
min_width=CPU: 100.00%
|
|
||||||
color=#adeaea
|
|
||||||
|
|
||||||
[name]
|
[name]
|
||||||
label=
|
label=
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ D ~/Documents
|
|||||||
ho ~/
|
ho ~/
|
||||||
lc ~/linux-config/
|
lc ~/linux-config/
|
||||||
m /run/media
|
m /run/media
|
||||||
ro /
|
o /
|
||||||
|
|
||||||
# }}} sys *
|
# }}} sys *
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user