You are not logged in.
Hi all,
I want to create a popup whenever new packages were automatically installed via a script, or a firewall blocked a certain rule, etc. How do I create custom popups?
Thanks,
Walter
Last edited by walterjwhite (2011-06-10 15:05:28)
Offline
look into zenity
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Hi Inxsible,
Thanks for your post - I'll check it out.
Walter
Offline
Hi,
I got it working, but I would still like to use the gnome 3 notification-system. I'll do some more reading into how to get that component working, if you know where to start, let me know.
Walter
Offline
in bash you could use notify-send:
notify-send 'Hello, World!'
It comes with libnotify.
edit: it seems using single-quotes solves some problems with special characters.
Last edited by Wey (2011-06-09 12:44:36)
Offline
Nice, that is more of what I am looking for.
I can easily specify a title / summary along with a long message body which should be exactly what I need.
Walter
Offline
Actually, I did all of my testing as the current user. When cron runs and calls notify-send or zenity, I get errors trying to raise the notification. How can I push that information to any and all logged in users?
Thanks,
Walter
Offline
Getting a list of logged in users may be a bit tricky depending on your setup. If you are not using startx/xinit from a tty login (which could be obtained with "users") you have to dig in how your display manager keeps track of logins.
To send the message to an actual user, you might have a look at this tutorial, describing how to send notifications from a remote location: http://cweiske.de/tagebuch/DBus%20notif … etwork.htm. It could be transferred to a cron scenario.
It basically boils down to giving sudo NOPASSWD rights for /usr/bin/notify-send on your user(s), exporting a DISPLAY, an XAUTHORITY, and then sudoing notify-send as your targeted user.
export DISPLAY=:0 && export XAUTHORITY=/home/$USER/.Xauthority && sudo -u $USER notify-send 'Test!' 2>&1
I haven't tested it yet though, and it may not be an entirely security sensitive approach (I'm especially thinking of denial of service here).
Offline
Why not send to every user running a "notification-daemon"?
for i in $(ps ux | grep notification-daemon | cut -f 1 -d " " | sort | uniq); do sudo -u ${i} notify-send "foobar"; done;
I'm not sure if you need the x authority for doing that:
for i in $(ps ux | grep notification-daemon | cut -f 1 -d " " | sort | uniq); do sudo -u ${i} XAUTHORITY=/home/${i}/.Xauthority notify-send "foobar"; done;
Parsing ps output is not nice, there's probably a better way.
edit: sudo shouldn't need a password since cron is already running as root, right?
Last edited by Cdh (2011-06-10 16:18:19)
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline