Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 11, 2007, 07:45 AM   #1
telecomm
macrumors 65816
 
telecomm's Avatar
 
Join Date: Nov 2003
Location: Rome
Fink newb question

So, I've discovered the world of X11 and Fink (after becoming interested in the GIMP). Using Fink Commander, I got a few binaries, which leads me to the following question.

Instead of opening X11 and typing, say, /sw/bin/gnubg, how might I go about creating some sort of desktop icon–type thing that I could click, and then have X11 open and a particular X11 app start up? (In this case, I'm interested in creating such an icon so my gf can play backgammon without having to interact with a command line.)

Thanks!
telecomm is offline   0 Reply With Quote
Old Jan 11, 2007, 08:29 AM   #2
wrldwzrd89
macrumors G4
 
wrldwzrd89's Avatar
 
Join Date: Jun 2003
Location: Solon, OH
Quote:
Originally Posted by telecomm View Post
So, I've discovered the world of X11 and Fink (after becoming interested in the GIMP). Using Fink Commander, I got a few binaries, which leads me to the following question.

Instead of opening X11 and typing, say, /sw/bin/gnubg, how might I go about creating some sort of desktop icon–type thing that I could click, and then have X11 open and a particular X11 app start up? (In this case, I'm interested in creating such an icon so my gf can play backgammon without having to interact with a command line.)

Thanks!
Command files (with a .command extension) are just the thing to solve these sorts of problems. Essentially, all a command file is is a shell script (with executable permissions set) with the .command extension. Double-clicking one of these will launch the Terminal and execute the various commands inside. In your specific case, to get around the problem of having the Terminal open, make it go away by launching the application in the background (append an ampersand (&) to the end of the command that launches the application to background), then using the killall command to make the Terminal quit in your script.
__________________
iMac Intel (Rev H, 27"), 1TB HDD, 16GB RAM, 10.8.4
wrldwzrd89 is offline   0 Reply With Quote
Old Jan 11, 2007, 11:49 AM   #3
telecomm
Thread Starter
macrumors 65816
 
telecomm's Avatar
 
Join Date: Nov 2003
Location: Rome
Thanks for that.

I'm new to scripting too.

Strangely, I'm able to get this to work with one binary, but not another. Here's my script

#!/bin/sh
open /applications/utilities/x11.app
/usr/bin/open-x11 /sw/bin/xgalaga
killall Terminal


For the game xgalaga this works, but when I replace xgalaga with gnubg (the backgammon game), the x11 window for the game briefly flashes on the screen and disappears, nowhere to be found. Not suprisingly, I have no idea why this is happening.

Of note, when I run the command open-x11 /sw/bin/xgalaga from Terminal things work, but running open-x11 /sw/bin/gnubg, the game window disappears as above. Any thoughts?

Last edited by telecomm; Jan 11, 2007 at 11:58 AM.
telecomm is offline   0 Reply With Quote
Old Jan 11, 2007, 04:03 PM   #4
wrldwzrd89
macrumors G4
 
wrldwzrd89's Avatar
 
Join Date: Jun 2003
Location: Solon, OH
Quote:
Originally Posted by telecomm View Post
Thanks for that.

I'm new to scripting too.

Strangely, I'm able to get this to work with one binary, but not another. Here's my script

#!/bin/sh
open /applications/utilities/x11.app
/usr/bin/open-x11 /sw/bin/xgalaga
killall Terminal


For the game xgalaga this works, but when I replace xgalaga with gnubg (the backgammon game), the x11 window for the game briefly flashes on the screen and disappears, nowhere to be found. Not suprisingly, I have no idea why this is happening.

Of note, when I run the command open-x11 /sw/bin/xgalaga from Terminal things work, but running open-x11 /sw/bin/gnubg, the game window disappears as above. Any thoughts?
Hmm... interesting. Try this:

#!/bin/sh
open /applications/utilities/x11.app&
/usr/bin/open-x11 /sw/bin/xgalaga
killall Terminal


Hopefully, that will detach the X11.app from the Terminal, so when you kill it, X11 won't go away. I'd test this, but I'm not at a Mac right now.
__________________
iMac Intel (Rev H, 27"), 1TB HDD, 16GB RAM, 10.8.4
wrldwzrd89 is offline   0 Reply With Quote
Old Jan 11, 2007, 05:59 PM   #5
telecomm
Thread Starter
macrumors 65816
 
telecomm's Avatar
 
Join Date: Nov 2003
Location: Rome
Thanks for the help, but that didn't work either. Since it works with one game and not the other, I this it's something specific to gnubg. If there were some way to pass X11 the string "/sw/bin/gnubg" and then have it execute that command, I think things would work, but something about starting in Terminal doesn't seem to agree with gnubg.

Oh well, after playing around with things for the evening, I think I've found a better alternative anyway. There's another version of gnubng that does come with its own clickable app thing, and it looks a lot better than the version I had been working with earlier.

Thanks again.
telecomm is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Fink higeorge Mac Basics and Help 1 Nov 16, 2010 03:27 PM
newb with newb question nownot Digital Video 5 Mar 23, 2007 02:58 PM
complete n00b to fink has questions BabaG OS X 1 Jan 29, 2007 11:49 AM
really newbe question xcode cocoa buttons linking type question paddy learner Mac Programming 12 Dec 7, 2005 07:39 AM
Newb question about office v.x badhorsie777 Mac Applications and Mac App Store 2 Jul 30, 2003 07:36 PM


All times are GMT -5. The time now is 05:15 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC