开发者

Python / Linux/ Daemon process trying to show gtk.messagedialog

on Ubuntu 8/9, i'm trying to write a daemon in python, that monitors a certain network condition and informs the user using a gtk.messagedialog. I installed this script using rc-update. The daemon starts at boot, but doesn't show the dialog even开发者_如何学运维 after I login. I assume because init.d starts my daemon at tty1 and no gnome is available. Tried running the dialog through a subprocess, but it seems to inherit the same run environment. Whats the best practice for this sort of thing.


If five users are logged in to X sessions, who gets the message? Everyone?

If someone is logged in locally but only using the tty, and not X11, should they see the message?

If someone is logged in remotely via ssh -X to run a graphic application on their own system off of your CPU, should they see the message? How would you get it to them?

Linux is too flexible for your current approach. The standard way to do this is for any user who is interested in the kind of message you are sending to run an application that receives the message and displays it in a way of its choosing. Dbus is a popular way of setting up the messaging process. This way remote users or users logged in with TTY mode only still have an option for seeing the message.


In order to find out whether your code works at all, you should first try and execute the daemon as normal program in a graphical shell (on a GNOME desktop).

You could also call zenity.


You may use notify-send (from libnotify-bin package) to send notifications to desktop users from your daemon.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜