Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
2021-01-22 08:49:44 +01:00
parent 64b1011bb7
commit 737bbbf5e9
3 changed files with 180 additions and 65 deletions

View File

@ -13,14 +13,14 @@ printf "%s%%\\n" "🔊 $vol"
}
print_wifi(){
[ "$(stat -c %y "/home/yorune/.config/vpn" 3>/dev/null | egrep -o '[0-9]+\-[0-9]+\-[0-9]+ [0-9]+')" != "$(date '+%Y-%m-%d %H')" ] && sudo /root/.local/bin/protonvpn status | grep -i Status | awk {'print $2'} > "/home/yorune/.config/vpn"
#[ "$(stat -c %y "/home/yorune/.config/vpn" 3>/dev/null | egrep -o '[0-9]+\-[0-9]+\-[0-9]+ [0-9]+')" != "$(date '+%Y-%m-%d %H')" ] && sudo /root/.local/bin/protonvpn status | grep -i Status | awk {'print $2'} > "/home/yorune/.config/vpn"
echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/")"
#echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/") $(cat /home/yorune/.config/vpn | sed 's/Connected/🌐/g;s/Disconnected/❌/g')"
}
print_temp(){
echo -e "🔥 $(sensors | awk '/Core 0/ {print int($3)"°C"}') +$(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')°C"
echo -e "🔥 $(sensors | awk '/Core 0/ {print int($3)"°C"}') $(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')°C"
}
print_date(){
@ -31,6 +31,35 @@ print_mem(){
free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB", ( $3 / 1024) )}'
}
print_music(){
# Source: https://github.com/joestandring/dwm-bar
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: cmus
if ps -C cmus > /dev/null; then
ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}')
TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}')
POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}')
DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}')
STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}')
SHUFFLE=$(cmus-remote -Q | grep -a '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
if [ "$STATUS" = "playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
#printf "%s%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%s" "$STATUS"
#printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
#printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
#printf "%s\n"
fi
}
print_battery() {
# Find the battery level
hash acpi || return 0
@ -68,6 +97,6 @@ print_cpu() {
while true
do
xsetroot -name "$(print_temp) $(print_mail) $(print_cpu) $(print_mem) $(print_wifi) $(print_battery) $(print_volume) $(print_date)"
xsetroot -name "$(print_music) $(print_temp) $(print_mail) $(print_cpu) $(print_mem) $(print_wifi) $(print_battery) $(print_volume) $(print_date)"
sleep 2
done