Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Starting X server from another program



Does the following work?

#!/usr/bin/env bash
if [ ! -f "socket file that X11 creates in /tmp" ]; then
	open /Applications/X11.app	
fi
export DISPLAY=:0
exec whatever

On Jul 18, 2007, at 7:04 AM, Dave Williss wrote:

I'm trying to find a way to have an X11 application start X11.app if it's not already running.
For the most part, something like this works pretty well...


* look for the socket file that X11 creates in /tmp. If not there, skip the next step
* call XOpenDisplay. If that works, X11 is running - nothing to do.
* find /Applications/Utilities/X11.app/Contents/MacOS/X11
* call execp() or system() to start it.
* call XOpenDisplay again


This has been working fine in most versions on Mac OS. However, launching X11 this way isn't working with the version of X11 from the latest beta OS. The X11 icon never shows up as having started in the task bar and the server never starts, but X11.app obviously did *something* because the console log reports that an xterm was unable to connect to the X server.

This is only a problem if I launch it via calls to execp() or system (). If I launch it from a command shell it works just fine.

I don't know for sure if it's the X11.app that's causing the problem or the OS itself. Maybe by using system() I'm bypassing some vital thing. I'm wondering if there's a more accepted way under OS X to have one program launch another.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/ mailman/options/x11-users/email@hidden


This email sent to email@hidden

--
✐The primary task of most software projects is to discover and resolve these unknowns rather than to build a system. -- Philip G. Armour
--
Richard Cook
βœ‡ Lawrence Livermore National Laboratory
Bldg-453 Rm-4037, Mail Stop L-557
7000 East Avenue, Livermore, CA, 94550, USA
☎ (office) (925) 423-9605
☎ (fax) (925) 423-6961
---
Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept.
(opinions expressed herein are mine and not those of LLNL)


_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/x11-users/email@hidden

This email sent to email@hidden
References: 
 >Starting X server from another program (From: Dave Williss <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.