Can I set up an icon that launches X11 and a remote app?

Discussion in 'Apple' started by Rob Yampolsky, Feb 4, 2005.

  1. I'm experimenting with a real Rube Goldberg mechanism to get Mac
    support for a proprietary WIN32 application. The point is to provide
    occasional access to a large pool of users without anteing up for
    Citrix licenses. Ideally, I'd just port the app to QT and produce a
    native Mac version, but I'm in a Chicken or egg situation, where I
    can't get funding for a port until we prove the market wants Mac


    Turns out that the app runs pretty well on Linux under WINE, and I was
    able to access it running on the Linux box from a Mac using X11.
    Assuming I can get this to work reliably, I'd have to accomplish 2
    more things to be able to deliver Mac support acceptably this way.

    1. Set up an icon (or dock button) on the Mac to launch the remote
    app. I guess this would involve logging into the Linux box and
    running the app. It'd be nice if the single icon could launch X11
    *and* my remote app. It looks like I might be able to script starting
    the remote app with ssh, like so:

    ssh -X [email protected] "wine myapp.exe"

    but is there a way to start ssh and X together?

    2. My app prints by producing a .pdf and launching the default pdf
    viewer. Assuming I can get WINE to associate pdf's with a Linux pdf
    viewer, I'm hoping that the viewer launched from my app would inherit
    the X display info and display in a new Mac X window. Then the users
    can print to a linux-visible printer.

    Unfortunately, I don't have access to a Mac with 0S/10.3 to try this
    right now, so I'd appreciate any comments on whether this is feasible.

    Rob Yampolsky, Feb 4, 2005
    1. Advertisements

  2. Rob Yampolsky

    D P Schreber Guest

    /usr/bin/open-x11 does exactly this.

    So suppose you have a script '' as follows:

    ssh -X foo xterm

    Then if you run 'open-x11', you get exactly the behavior
    you want (probably you want to set up keys so that no password or
    passphrase is required).

    Now make 'open-x11' into a script itself, give it the
    extension '.command' and it can be double-clicked. The only downside of
    this approach is that it will open as a side-effect. If
    you don't want that to happen, you can take this second shell script (ie
    'open-x11') and make it into double-clickable .app via
    Platypus. Or you can write it as an AppleScript.

    Of course you have to ensure that your users have installed. It
    isn't by default.
    D P Schreber, Feb 5, 2005
    1. Advertisements

  3. This kind of works, except I had to code my script like this:
    xterm -e ssh -X [email protected] "wine mywindowsapp.exe"

    In other words, I needed to explicitly start a local xterm to run ssh
    in. Otherwise nothing happens. In any case, starting up X11 seems to
    start it's own xterm with a command prompt, probably because the
    /usr/X11R6/xinit/xinitrc file has an xterm& command in it. So I kind
    of have what I want, except I end up with 2 xterm windows in addition
    to my remote X application. The 2nd xterm window closes when my
    remote app finishes, but the first doesn't.

    When I take the extra step of including my script in a .command file
    to produce a clickable script, I end up with 2 xterm windows *plus* a
    terminal window that opens to run the script (and stays open once the
    script completes). Am I missing something? I didn't set up ssh keys,
    so ssh *is* prompting me for a password. Could that be the only
    reason I have to start ssh in an xterm window? In other words, if I
    figured out how to set up ssh keys, would the 2nd xterm window be
    unnecessary? If so, and if I got rid of the xterm& in xinitrc, then
    it would seem to work the way you described.

    I don't want to mess with the default X11 installation, but I had
    thought of copying the open-x11 script and modifying it to point X11
    to a different xinitrc script. But open-x11 uses the 'open' command
    to launch, and I'm not sure how to override the defaults with
    that launch method. Is that possible? Advisable?

    Finally, there seems to be an Applications menu provided by X11 itself
    (once you've started it). I tried putting an entry for my remote app
    there, but had no luck with any combination of open-x11, xterm, ssh,
    etc. Any point in trying to use this menu?
    Rob Yampolsky, Feb 9, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.