On Aug 7, 2006, at 8:44 AM, Jean-Marc Lasgouttes wrote:

"Bennett" == Bennett Helm <[EMAIL PROTECTED]> writes:

E.g., it's probably good that you're explicitly setting DISPLAY to
be safe, while open-x11 doesn't seem to be doing that.

Bennett> I've used "open-x11 && export DISPLAY=:0.0 && xfig" -- an
Bennett> improvement over the hardcoding of the location of X11.app.

The code I found related to open-x11 does set DISPLAY, I think. What
would it do otherwise?

Could you post this script, so that we can have a look? The version I
found at
http://www.oreillynet.com/pub/h/901
for example, seems to accept command arguments.

This is Apple's script (found at /usr/bin/open-x11).

Bennett

---------

#!/bin/bash

# usage: open-x11 PROGRAM-1 PROGRAM-2 ... PROGRAM-N


# this will often work (always, if X11 is already running)

x11_app=X11

# but try to find the real location just in case..

if [ -d /Applications/Utilities/X11.app ]; then
  x11_app=/Applications/Utilities/X11.app
elif [ -d /Applications/X11.app ]; then
  x11_app=/Applications/X11.app
fi


# fix $PATH to include X directories

for d in /usr/X11R6/bin /usr/bin/X11 /usr/local/bin/X11; do
  if [ -d $d ]; then
    case $PATH in
      '')
        PATH=$d
        ;;
      $d|$d:*|*:$d|*:$d:*)
        : do nothing
        ;;
      *)
        PATH=$PATH:$d
        ;;
    esac
  fi
done


# try to launch each app

while [ $# -ge 1 ]; do
  app="$1"; shift

  if [ ! -f "$app" ]; then
    # preserve previous behaviour of searching likely locations
    real_app=`type -p "$app"`
    if [ -z "$real_app" ]; then
      echo "$1: unknown application: $app"; exit 1
    fi
    app="$real_app"
  fi

  /usr/bin/open -a "$x11_app" "$app"
done


Reply via email to