xfrun and dbus

Brian J. Tarricone bjt23 at cornell.edu
Fri Mar 10 00:08:54 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 3/9/2006 12:46 PM, Jani Monoses wrote:
> Hello
> 
> here's a cleaner xfrun dbus service + client patch.
> 
> When built without dbus it behaves exactly as now.
> When dbus is enabled it does the following
> -  If run with no arguments it tries connecting to a RunDialog service
> and if not found falls back to current behaviour.
> -  If run with --daemon as argument tries to register itself and provide
> a service or exit on failure.
> -  If there's an argument which is not --daemon it behaves like now.
> 
> This way whoever wants to get faster dialog will launch xfrun --daemon
> in xinitrc for example, others are not affected.
> 
> I have tested it in xnest with two screens and it correctly launches the
> dialog on the appropriate screen, although there may be a cleaner or
> more correct way of getting the GdkScreen from a :display.screen string
> 
> The verve plugin could take advantage of this too by providing a service
> and simply aquiring focus when it is contacted.
> 
> please consider applying this

Cool, thanks.  I'm not sure if we want to link xfrun to dbus - I'll let
someone else debate that.

Personally I'd rather see two binaries, which unfortunately share much
of the same dialog code (best would be to stick it in a static library).
 'xfrun4-daemon' just runs as a daemon, provides a dbus service, and
shows the dialog as necessary.  'xfrun4' does not link with dbus, and
tries to use 'dbus-send' to launch a dialog, and then presents a
non-daemon run dialog if that fails.  (Can dbus-send report failure?)  I
think Benny had some thoughts on this; I don't recall exactly.

One thing that needs to be fixed though for inclusion: the --daemon
implementation is not correct.  If the user runs that from a terminal,
xfrun will quit when the terminal is closed.  The best way is to check
for the presence of the daemon() libc call, and if that's not present,
use fork() and setsid(), and run the daemon in the child process, while
the parent quits with _exit() (note the leading underscore).

	-brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFEELWG6XyW6VEeAnsRAjz+AJ40p+/8RtYDMSXgkgd3lDHl+u56/ACeMO7G
AbvJYZMbhqLU8H7xqIJEK+U=
=WZAP
-----END PGP SIGNATURE-----



More information about the Xfce4-dev mailing list