cfg/.config/i3blocks/mem
Knut Ahlers 4ae353dc51
Bring more color to the i3bar
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-12-03 15:22:12 +01:00

10 lines
270 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
mem_use=$(free | awk '/Mem:/{ printf "%.0f", (($2 - $7) / $2) * 100 }')
color='#ffffff'
[ ${mem_use} -gt 70 ] && color='#ffd966'
[ ${mem_use} -gt 90 ] && color='#dd0000'
printf '\uf85a <span color="%s">%.0f%%</span>' ${color} ${mem_use}