I am missing libxfcegui4's xfce-exec functions [1] in PyXfce. For now I use xfce4.gui.gdk_spawn_command_line_on_screen, but it lacks the terminal and startup notification support of xfce-exec. Reproducible: Always Steps to Reproduce: [1]: http://www.xfce.org/documentation/api-4.2/libxfcegui4/libxfcegui4-xfce-exec.html and xfce_exec_on_screen.
"exec" is a reserved word in python. "exec" gives the wrong idea of what the function is doing (it does _not_ replace the caller's process by the called process like exec(3)). There are way too many xfce_exec variants. Startup notification stuff should be in gtk (gtk_spawn...) instead. That said, if you or I can come up with a nice single function for python with a nice non-stupid name that does the same stuff for now (until gtk includes it), I'm all for it :)
_and_ the timeout stuff of startup notification is a bad idea to begin with.
(In reply to comment #1) > That said, if you or I can come up with a nice single function for python with a > nice non-stupid name that does the same stuff for now (until gtk includes it), > I'm all for it :) What about something like: def execute(command, in_terminal=False, use_sn=False, env=None, screen=None) Maybe with another name, but it's a single function.
I think we need to add some stuff to xfce to make that work nicely without giving me nightmares. Actually I'm doing that right now :)
#!/usr/bin/env python import xfce4 import gtk import os screen = gtk.gdk.screen_get_default() id = xfce4.gui.startup_notification_start(screen, "/usr/bin/devhelp") print id new_environment = os.environ.copy() new_environment[xfce4.gui.STARTUP_NOTIFICATION_ID_KEY] = id # spawn using the usual python functions with an environment key added: if os.spawnve(os.P_NOWAIT, "/usr/bin/devhelp", ("/usr/bin/devhelp", ), new_environment) < 0: print "FAILED" xfce4.gui.startup_notification_cancel(id) gtk.main()
import xfce4 xfce4.gui.spawn_command_line("devhelp") or xfce4.gui.spawn_args(("/usr/bin/devhelp", )) def spawn_command_line(command_line, in_terminal = False, use_startup_notification = True, screen = None, environment = None) def spawn_args(args, in_terminal = False, use_startup_notification = True, screen = None, environment = None) (see gui.py)
should be "fixed" now :)
(In reply to comment #7) > should be "fixed" now :) It works, thanks :)