Page 1 sur 1

[bspwm] besoin de reload polybar pour dunst [Résolu]

Publié : mer. 14 avr. 2021, 11:14
par manix
Bonjour

J'ai pris un script sur le net pour avoir les MAJ arch en temps réel dans polybar ... le voici :

Code : Tout sélectionner

#!/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
done
Tout fonctionne parfaitement dan polybar le nombre de MAJ s'affiche bien, mais je suis obligé de reload polybar pour avoir la notif de dunst ...

je lance dunst et polybar via bspwm et j'ai bien-sur installé pacman-contrib et libnotify.

j'ai regardé aussi dans /usr/share/dbus-1/services pour savoir si y'a autre dbus daemon mais non, juste org.knopwob.dunt.service.

j'ai check aussi le script de lancement de polybar mais rien y fait .. après plusieurs manip (méme juste de lancée "polybar mybar" cela ne fonctionne pas .

je post le script au cas ou :

Code : Tout sélectionner

#!/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 &

#echo "Bar Lancée!"
voila, je reste a disposition pour tout autre info ! merci d'avance
Nico

Re: [bspwm] besoin de reload polybar pour dunst

Publié : mar. 20 avr. 2021, 08:32
par manix
Après pas mal de test sans resultat avec "notify-send". j-ai juste changé la commande par "dunstify" et ca fonctionne au poil ! resolu :bravo: