On 11/17/2016 10:09 AM, Teemu Likonen
wrote:
I don't know whether this qualifies as a work around that you are not interested in, but I have found that this works. From you script use the following:I have a backup script that runs once a day with root privileges. It's handled by systemd timer and service units. I would like to have a desktop notification text when the backup is ready. What I have tried so far: I don't use normal desktop, only i3 window manager. I installed notify-osd package and started its daemon as a normal user. Running a command "notify-send foo" shows "foo" text like I expected. But when "notify-send" runs as root no notification text appear anywhere. How can I get notifications working in plain window manager setup? And hopefully not only this backup script example but for other programs too, like Network Manager's notifications. I'm not really interested in work-arounds like "DISPLAY=:0 xmessage -timeout 5 foo". sudo -u <username> notify-send fooSince the script is running with root privileges, sudo will not need a password to run the notify-send command as a lesser privileged user. I haven't tried this from a script, but did do it from the keyboard. I verified that notify-send would not send a notification to me when sudo'ed as root, and then used the above command. It did indeed work. The <username> that you use is the username that you are normally logged in as. -- 73's de Mike, WB5VQX |