bar: add memory
This commit is contained in:
parent
e000de618c
commit
d71555a138
2 changed files with 28 additions and 2 deletions
|
@ -50,11 +50,27 @@ check_df() {
|
|||
df=""
|
||||
df="/:$(df --output=pcent / | tail -n+2 | xargs)"
|
||||
|
||||
[[ "$root_dev" = "$home_dev" ]] || df+=" $USER:$(df --output=pcent "$HOME" | tail -n+2 | xargs)"
|
||||
if [[ "$root_dev" != "$home_dev" ]]
|
||||
then
|
||||
df+=" $USER:$(df --output pcent "$HOME" | tail -n+2 | xargs)"
|
||||
fi
|
||||
|
||||
update df "$df"
|
||||
}
|
||||
|
||||
check_mem() {
|
||||
local mem
|
||||
mem="$(awk '
|
||||
/^MemAvailable/ { memavail=$2 }
|
||||
/^SwapTotal/ { swaptotal=$2}
|
||||
/^SwapFree/ { swapfree=$2 }
|
||||
/^MemTotal/ { memtotal=$2 }
|
||||
END { print memtotal"\t"memtotal-memavail"\t"swaptotal"\t"swaptotal-swapfree }
|
||||
' < /proc/meminfo )"
|
||||
|
||||
update memory "$mem"
|
||||
}
|
||||
|
||||
while :
|
||||
do
|
||||
# shellcheck source=/sys/class/power_supply/BAT0/uevent # most likely
|
||||
|
@ -80,6 +96,7 @@ do
|
|||
which iwctl &>/dev/null && update wifi "$(iwctl station wlan0 show |grep 'Connected network' | sed 's/ */ /g' | cut -d ' ' -f 4-)"
|
||||
|
||||
check_df
|
||||
check_mem
|
||||
#if [ -e /run/user/1000/cmus-socket ]
|
||||
#then
|
||||
#update player "$(printf '%s\t%s \t%s' "$(playerctl metadata artist | tr -d "'" )" "$(playerctl metadata xesam:comment)" "$(playerctl metadata title)")"
|
||||
|
|
|
@ -117,7 +117,7 @@ hc --idle | {
|
|||
### center
|
||||
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
|
||||
### print the right
|
||||
res+="%{r}$df $separator $playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
res+="%{r}$memory $df $playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
#echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
done
|
||||
|
||||
|
@ -240,6 +240,15 @@ hc --idle | {
|
|||
[[ "${perc%%%}" -lt 80 ]] && continue
|
||||
df+=" $name $perc"
|
||||
done
|
||||
[[ -n "$df" ]] && df+=" $separator"
|
||||
;;
|
||||
memory)
|
||||
if (( (cmd[2]*100) / cmd[1] > 50 ))
|
||||
then
|
||||
memory=" $(LC_ALL=C numfmt --from-unit=Ki --to=iec --format %.2f ${cmd[2]}) $separator"
|
||||
else
|
||||
memory=""
|
||||
fi
|
||||
;;
|
||||
temperature)
|
||||
temperature=" ${cmd[1]}°C"
|
||||
|
|
Loading…
Add table
Reference in a new issue