hello fellows, I’d like to get some scripts output blinking in polybar as they do in the terminal, for example the updates notification. My script is:
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
# if ! updates_aur=$(yay -Qum | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo -e "\e[5m$updates"
else
echo "0"
fi
But unfortunatly it doesn’t work in polybar. Any suggestion ?
Blinking is something supported by most terminal emulators but isn’t standard for text input like this, polybar is free to ignore any sequences it wants.
You can get a similar effect using sleep and multiple echo to clear and reprint
Yes I’ve tried the sleep sequences but no expected result, in fact the module crashed so maybe I should ask the polybar dev for that comestic aspect , thanks anyway.
I have found this discussion Blinking format tag so maybe one day…
#!/bin/bash
if (( (count=$(checkupdates 2>/dev/null | wc -l)) > 0 )); then
while :; do
printf "%d\n" $count
sleep 0.3
printf "%*s\n" ${#count} # number of characters to fill with spaces to stop bar contents shifting
sleep 0.3
done
else
printf "\n"
fi
Hello nate, first of all thank you for your help. I think your solution is good but I’m going to increase the interval with polybar ipc hooks once an hour or so because of cpu (while loop) and network requests over archlinux server (I don’t want to be banned) .