You are not logged in.
Hello
I took a script from the net to have the arch updates in real time in polybar ... here it is:
#!/usr/bin/env bash
NOTIFY_ICON=/usr/share/icons/Papirus/32x32/apps/system-software-update.svg
get_total_updates() { UPDATES=$(checkupdates 2>/dev/null | wc -l); }
while true; do
get_total_updates
# notify user of updates
if hash notify-send &>/dev/null; then
if (( UPDATES > 12 )); then
notify-send -u critical -i $NOTIFY_ICON \
"Il faut vraiment MAJ!" "$UPDATES New packages"
elif (( UPDATES > 6 )); then
notify-send -u normal -i $NOTIFY_ICON \
"Une pt'ite MAJ s'impose!" "$UPDATES New packages"
elif (( UPDATES > 2 )); then
notify-send -u low -i $NOTIFY_ICON \
"Gogo?" "$UPDATES New packages"
fi
fi
# when there are updates available
# every 10 seconds another check for updates is done
while (( UPDATES > 0 )); do
if (( UPDATES == 1 )); then
echo "$UPDATES"
elif (( UPDATES > 1 )); then
echo "$UPDATES"
else
echo "It's good!"
fi
sleep 10
get_total_updates
done
# when no updates are available, use a longer loop, this saves on CPU
# and network uptime, only checking once every 30 min for new updates
while (( UPDATES == 0 )); do
echo "It's good!"
sleep 1800
get_total_updates
done
doneEverything works perfectly in polybar the number of updates is displayed well, but I have to reload polybar to get the dunst notification ...
I run dunst and polybar via bspwm and of course I installed pacman-contrib and libnotify.
I also looked in "/usr/share/dbus-1/services" to see if there is another dbus daemon but no, just "org.knopwob.dunt.service".
I also checked the polybar launch script but nothing worked there .. after several manipulations even just launching "polybar mybar" it does not work.
#!/bin/bash
DIR="$HOME/.config/polybar"
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.config/polybar/config
polybar -q top -c "$DIR"/config.ini &voila, I remain available for any other info! thank you in advance !
Nico
Last edited by Manix (2021-04-20 06:27:03)
I don't love rosbeef
Offline
i change "notify-send" > "dunstify" work perfectly , resolved.
I don't love rosbeef
Offline
finally I mix and modified the config with "notify-send"
#!/bin/sh
icon=""
NOTIFY_ICON=/home/nico/.local/share/icons/oomox-red/48x48/apps/system-software-update.svgif ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi# if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
# if ! updates_aur=$(rua upgrade --printonly 2> /dev/null | wc -l); then
if ! updates_aur=$(pikaur -Qua 2> /dev/null | wc -l); then
updates_aur=0
fiupdates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo "%{F#DB4B4B}$icon %{F#C0CAF5}$updates Packages"
else
echo "%{F#6D91DE}$icon %{F#C0CAF5}it's good!"
fiif hash notify-send &> /dev/null; then
if (( updates > 8 )); then
notify-send -u critical -i $NOTIFY_ICON \
"Il faut vraiment mettre a jour!!" "$updates New packages"
elif (( updates > 4 )); then
notify-send -u normal -i $NOTIFY_ICON \
"Tu peu mettre a jour!" "$updates New packages"
elif (( updates > 0 )); then
notify-send -u low -i $NOTIFY_ICON \
"$updates New packages"
fi
fi
[module/updates]
type = custom/script
exec = ~/.config/polybar/scripts/updates-pacman-aurhelper.sh
interval = 450
tail = true
click-right = urxvt -e zsh -c "pikaur -Syu && sleep 8"
click-left = urxvt -e zsh -c "checkupdates && sleep 8
reresolved ![]()
I don't love rosbeef
Offline