Writing an app launcher: checking to see if the window started up? - Xwindows

This is a discussion on Writing an app launcher: checking to see if the window started up? - Xwindows ; I'm writing an application launcher. It spawns GUI commands on remote hosts via ssh tunnels, potentially behind multiple firewalls, and perhaps other forms of tunnels later. I want to provide some sort of feedback to the user as to whether ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Writing an app launcher: checking to see if the window started up?

  1. Writing an app launcher: checking to see if the window started up?


    I'm writing an application launcher. It spawns GUI commands on remote
    hosts via ssh tunnels, potentially behind multiple firewalls, and perhaps
    other forms of tunnels later.

    I want to provide some sort of feedback to the user as to whether the
    window started up OK.

    My application is in PyGTK2 (and will be GPL'd) but I'm spawning generic X
    apps, including apps based on Gnome, KDE, Motif, Athena, and so on.

    Is there something in X I can query to see if these apps are being added
    to the display?

    I'd be willing to add a little C program to do the querying, if need be,
    though I'd prefer to stay with pure python if possible.

    Ideal might be if I could feed a random, longish cookie to an application
    upon startup, and then query the X server to see if there is an
    application that has that cookie-attribute.

    Barring that, I see some semi-useful stuff in "xwininfo -root -tree", but
    I'd prefer not to have to ask the enduser for the magic strings to search
    for in that, if possible.

    Any suggestions?

    Thanks!




  2. Re: Writing an app launcher: checking to see if the window startedup?

    Dan Stromberg wrote:

    > I'm writing an application launcher. It spawns GUI commands on remote
    > hosts via ssh tunnels, potentially behind multiple firewalls, and perhaps
    > other forms of tunnels later.
    >
    > I want to provide some sort of feedback to the user as to whether the
    > window started up OK.
    >
    > My application is in PyGTK2 (and will be GPL'd) but I'm spawning generic X
    > apps, including apps based on Gnome, KDE, Motif, Athena, and so on.
    >
    > Is there something in X I can query to see if these apps are being added
    > to the display?


    X isn't going to be of much help here. There's no reliable way to
    determine whether some application has come up successfully by looking
    at the display. You might see an error window come up and then go away
    and interpret it as success.

    If the application fails to come up and exits with non-zero you should
    report that as a problem and any output on stderr. But some
    applications may have non-X errors and pop up an error dialog then wait
    for a response. Such an app would look happy to you until someone
    dismisses the dialog.

    The best you can do at the X level is provide passive dynamic feedback
    about what is going on on the server side and let the user interpret
    it. The feedback I'd suggest would include a perfmeter to show CPU
    status and an event log of application level windows/titles coming and
    going on the remote display. The latter could be just a diff of the
    output of xlsclients over time. So if I launch say an xterm I should
    see the CPU go busy and then one or more messages indicating that a new
    xterm came up.

    -- ced

    >
    > I'd be willing to add a little C program to do the querying, if need be,
    > though I'd prefer to stay with pure python if possible.
    >
    > Ideal might be if I could feed a random, longish cookie to an application
    > upon startup, and then query the X server to see if there is an
    > application that has that cookie-attribute.
    >
    > Barring that, I see some semi-useful stuff in "xwininfo -root -tree", but
    > I'd prefer not to have to ask the enduser for the magic strings to search
    > for in that, if possible.
    >
    > Any suggestions?
    >
    > Thanks!
    >
    >
    >



    --
    Chuck Dillon
    Senior Software Engineer
    NimbleGen Systems Inc.

  3. Re: Writing an app launcher: checking to see if the window started up?

    Dan Stromberg wrote:
    >
    >I'm writing an application launcher. It spawns GUI commands on remote
    >hosts via ssh tunnels, potentially behind multiple firewalls, and perhaps
    >other forms of tunnels later.
    >
    >I want to provide some sort of feedback to the user as to whether the
    >window started up OK.
    >
    >My application is in PyGTK2 (and will be GPL'd) but I'm spawning generic X
    >apps, including apps based on Gnome, KDE, Motif, Athena, and so on.
    >
    >Is there something in X I can query to see if these apps are being added
    >to the display?
    >
    >I'd be willing to add a little C program to do the querying, if need be,
    >though I'd prefer to stay with pure python if possible.
    >
    >Ideal might be if I could feed a random, longish cookie to an application
    >upon startup, and then query the X server to see if there is an
    >application that has that cookie-attribute.
    >
    >Barring that, I see some semi-useful stuff in "xwininfo -root -tree", but
    >I'd prefer not to have to ask the enduser for the magic strings to search
    >for in that, if possible.
    >
    >Any suggestions?
    >
    >Thanks!


    For the sake of using the correct terminology, what you are doing is
    called Session Management. So, either you are trying to extend the
    functionality of an existing session manager, or you are trying to
    roll your own -- I can't really discern which.

    Historically, X has had xsm as a session manager, and xsm uses the
    XSMP protocol. A compliant application has the responsibility of
    supplying certain information for session management: most do, but
    those that don't will, of course, be a problem.

    A full-function client initiates a connection with the session manager
    in order to provide information, and in order to respond to certain
    events (such as session shutdown). Such a client historically would
    do so by using the Xt session management functionality.

    It is also possible to write a minimal-function client, and in fact,
    this is very common. These clients do not have to connect to the
    session manager -- what happens is that their presence is detected by
    a "session manager proxy" that notices their launches and communicates
    with the session manager for them. For this to work, the clients must
    provide a minimal set of properties on their top-level windows.

    What you are trying to do is has to fit this framework in some
    fashion. There are many possible designs, but the simplest is
    probably something like emulating a session manager proxy to some
    degree. That is, you monitor top-level window creation; you monitor
    property events on such windows; you interpret the creation of session
    management properties as confirmation that the window has been
    launched.

    You probably should start by looking at the session management
    sections of the ICCCM.


  4. Re: Writing an app launcher: checking to see if the window started up?

    Dan Stromberg writes:

    > I want to provide some sort of feedback to the user as to whether the
    > window started up OK.
    >
    > My application is in PyGTK2 (and will be GPL'd) but I'm spawning generic X
    > apps, including apps based on Gnome, KDE, Motif, Athena, and so on.


    I believe a "startup notification" protocol has been designed for
    this, and GNOME now uses it. But I don't know how well it works
    with clients that don't explicitly support it.

    http://www.freedesktop.org/wiki/Soft...2dnotification
    http://www.freedesktop.org/wiki/Stan...ication_2dspec
    http://www.freedesktop.org/software/...tion/releases/

+ Reply to Thread