72 lines
1.4 KiB
Bash
Executable File
72 lines
1.4 KiB
Bash
Executable File
#!/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
|
|
}
|
|
|
|
music() {
|
|
ARTIST=$(playerctl metadata artist)
|
|
TRACK=$(playerctl metadata title)
|
|
#DURATION=$(playerctl metadata mpris:length | sed 's/.\{6\}$//')
|
|
STATUS=$(playerctl status)
|
|
|
|
if [ "$STATUS" = "Playing" ]; then
|
|
STATUS=""
|
|
else
|
|
STATUS=" "
|
|
fi
|
|
|
|
if [ "$ARTIST" = "" ]; then
|
|
printf ""
|
|
else
|
|
printf "^c#656565^ "
|
|
printf "$STATUS "
|
|
printf "^c#d4d5d5^$ARTIST - $TRACK"
|
|
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 "$(music) $(update_icon) $updates $(weather) $(cpu) $(mem) $(clock)"
|
|
done
|
|
|