0

I have an application that spawns a GTK+ dialog. When running from the terminal, it works correctly. The problem is my application runs as a daemon and is started by a script inside /etc/init.d

I think everything that is launched using an init script is placed inside tty1, where no GNOME is available (it's on tty7). I don't know if that is correct, but how can I solve this issue?

Thank you in advance!

2 Answers 2

2

I'm pretty sure a daemon should never include GUI stuff... This belongs to the client application that communicates with the daemon.

2
  • 1
    Maybe to be clear enough with this answer: you should divide you app in two parts. One part is the core daemon, serving info and listening for order, the other part is the GUI client. Both communicate through network, shared memory, pipes...
    – moala
    Commented Jul 3, 2011 at 11:33
  • Thanks for your comment. Indeed, a daemon should never display anything, it was a conceptual mistake I was falling into. If anyone is attempting to do the same and eventually read this topic, please, change your design! Commented Aug 2, 2011 at 13:59
1

Well, the problem is not the tty, the problem is that inside your X server you have $DISPLAY set, so Gtk+ knows where to display your window. On a tty (i.e. in a script that's not run from inside of X), it's not set, so Gtk+ has no idea where to display the window. You also cannot assume that X is running on a specific display or even that X is available, which is the reason why you should never have a daemon display anything. A good daemon doesn't expect user input, doesn't display anything and redirects all of its output to a log file or syslog.

Not the answer you're looking for? Browse other questions tagged or ask your own question.