add new bar

This commit is contained in:
Agnosto Dvonik 2024-02-03 20:44:04 -05:00
parent d0a6a58560
commit 587dfef489
1 changed files with 4 additions and 19 deletions

View File

@ -1,24 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
red=#cf6a4c
green=#99ad6a
yellow=#d8ad4c
sleep=1 sleep=1
batt() {
num=$(apm -l)
bstat=$(apm -b)
case "$bstat" in
0|4|255) c=""; ;;
1) c="-"; ;;
2) c="--"; ;;
3) c="++"; ;;
esac
echo "$c$num%"
}
used() { used() {
used=$(vmstat | awk 'END {printf $3}' | tr -d "M") used=$(vmstat | awk 'END {printf $3}' | tr -d "M")
full=$(expr $(sysctl -n hw.usermem) / 1048576) full=$(expr $(sysctl -n hw.usermem) / 1048576)
@ -27,7 +10,9 @@ used() {
} }
chkinet() { chkinet() {
out=$(ifconfig $(ifconfig | grep -E "UP,BROADCAST,RUNNING" | cut -f1 -d ":") | grep "status" | cut -f2 -d ":" | tr -d " ") #int=$(ifconfig | grep -E "UP,BROADCAST,RUNNING" | cut -f1 -d ":")
int=iwx0
out=$(ifconfig "$int" | grep "status" | cut -f2 -d ":" | tr -d " ")
case "$out" in case "$out" in
"active") echo "Up"; ;; "active") echo "Up"; ;;
@ -36,6 +21,6 @@ chkinet() {
} }
while true; do while true; do
echo "%{c}$USER@$(hostname) - $(date "+%Y-%m-%d - %H:%M") - $(chkinet) - $(used) - $(batt) " echo "%{r}$USER@$(hostname) - $(date "+%Y-%m-%d %H:%M %Z") - $(chkinet) - $(used) - $(apm -l)% "
sleep $sleep sleep $sleep
done done