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

Similar Threads
thread Thread Starter Forum Replies Last Post
Newb USB hub question... Nirurin Mac Peripherals 14 Dec 28, 2013 09:20 AM
Newb Question about closing lid cclloyd Mac Basics and Help 3 Feb 20, 2013 09:33 PM
iPhone: Jailbreak newb question mattypurvis Jailbreaks and iOS Hacks 7 Feb 12, 2013 06:12 AM
Newb Itunes question Mattmeyeruk iMac 6 Sep 26, 2012 08:24 AM
Steam For Mac Help: Newb Question Prof. Community Discussion 3 Jul 23, 2012 11:07 AM

Forum Jump

All times are GMT -5. The time now is 02:29 AM.

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

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