Open c-c-6ypo8 opened 9 months ago
Also, even if I added root in sudoers, I get another error at line 163 because users command generates root user because I am logged in as root (because of not using sudo). So, your script doesn't respect non-sudo linux use. Also with sudo use it generates error if the root is logged in (because root cannot connect to DISPLAY to get notification). So I've fixed notify function to:
notify() {
for u in $(users | tr ' ' '\n' | sort -u); do
if [ $u != 'root' ]; then # I've added this line
sudo -u $u DISPLAY=:0 \
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(sudo -u $u id -u)/bus \
notify-send -a $name "$1" "$2" --icon="dialog-$3"
fi
done
}
And this variant seems to work properly (with root added to sudoers). But fully no-sudo variant still isn't working.
I don't have sudo in my system and I don't want to use it. So my snap-sync tells this after run without arguments: