Initial commit

main
kvj 2023-10-24 12:51:24 +02:00
commit 5c79830dfd
2 changed files with 49 additions and 0 deletions

0
README.md Normal file
View File

49
dwm-bar Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
interval=0
pkg_updates() {
updates=$(emerge -pvu --newuse --deep --with-bdeps=y @world | grep Total | grep -o '[[:digit:]]*' | grep -m1 "") # gentoo
if [ "$updates" = 0 ]; then
printf "^c#efefef^ Fully Updated"
else
printf "^c#d4d5d5^ $updates"" updates"
fi
}
weather() {
weather=$(curl -s wttr.in/Reda?format=1 | grep -o ".[0-9].*")
printf "^c#656565^  "
printf "^c#d4d5d5^$weather"
}
cpu() {
cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
printf "^c#656565^  "
printf "^c#d4d5d5^$cpu_val"
}
update_icon() {
printf "^c#656565^ 󰏗"
}
mem() {
printf "^c#656565^ 󰍛 "
printf "^c#d4d5d5^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
}
clock() {
printf "^c#656565^  "
printf "^c#d4d5d5^ $(date '+%a, %I:%M %p') "
}
while true; do
[ $interval == 0 ] || [ $(($interval % 3600)) == 0 ] && updates=$(pkg_updates)
interval=$((interval + 1))
sleep 1 && xsetroot -name "$(update_icon) $updates $(weather) $(cpu) $(mem) $(clock)"
done