dotfiles/bin/bar
Agnosto Dvonik 238738297f black
2023-02-07 19:42:20 -05:00

45 lines
766 B
Plaintext
Executable File

inet_int=iwm0
fg=#fff
bg=#000
red=#f92672
green=#a6e22e
blue=#66d9ef
yellow=#f4bf75
batt() {
num=$(apm -l)
bstat=$(apm -b)
case "$bstat" in
0|4|255) c=$fg; ;;
1) c=$yellow; ;;
2) c=$red; ;;
3) c=$green; ;;
esac
echo "%{F$c}$num%%{F$fg}"
}
used() {
used=$(vmstat | awk 'END {printf $3}' | tr -d "M")
full=$(expr $(sysctl -n hw.usermem) / 1048576)
tp=$(expr $full / 2)
[ $used -ge $tp ] && c=$red || c=$fg
echo "%{F$c}$used/$full%{F$fg}"
}
while true; do
me=$(echo "$USER@$(hostname)")
version=$(uname -rv)
date=$(date "+%Y-%m-%d %H:%M")
chkinet=$(ifconfig $inet_int | grep status | cut -d " " -f2-)
used=$(used)
batt=$(batt)
wttr=$(cat "$HOME/share/misc/wttr")
echo " $date $wttr%{r}$me $version $chkinet $used $batt "
sleep 0.5
done