|
|
Just use a unix script
I've been doing this for a long time, but with ssh xwindow sessions:
Just use a unix script
This can be a real pain if you don't have a terminal running all the time, or if you use an application launcher like LaunchBar. I have a USENET post on turning X and console applications into regular double-clickable applications via Applescript:
Point conceded...
Heh heh... Being a sysadmin, there's almost never a time that I don't have term open... And I also use ssh port forwarding to deal with my personal mail, so even when I'm not working term is up... But it's a good point, for the traditional non-unixy macuser the applescript has some definite advantages...
Script example for Command Line Mongrals
My text editor (VIM) has both an X11 version and a MacOS version. I prefer the X11 one but don't always have X11 running. So I created a script to select the prefered version depending. It's a sample that you can use.
#!/bin/sh showhelp() { cat <<EOF This is a wrapper script for the graphical version of VIM. The script recognizes the following command line options. Only the first option will be recognized. -h This cruft --help vim --help -x, --x11 force X11 gvim (Start X Server if not one already runnung) -X, --no-x11 force MacOS gvim -- NO-OP (pass remaining options as-is) If you do not force a display method one will be guessed based on the DISPLAY environment variable and the presence of X11.app running. EOF } case "$1" in --) shift; X11=ukn;; -h|-help) showhelp; exit -1;; --help) exec vim --help;; -x|--x11) shift; X11=yes;; +x|-X|--no-x11) shift; X11=no;; *) X11=ukn;; esac case `basename "$0"` in xvim) X11=yes;; mvim) X11=no;; esac if [ -z "$DISPLAY" ]; then if [ -z "`ps ax | grep X11.app | grep -v grep`" ]; then if [ $X11 == yes ]; then open -a X11 sleep 5 export DISPLAY=:0 else X11=no fi elif [ $X11 != no ]; then export DISPLAY=:0 X11=yes fi elif [ $X11 != no ]; then X11=yes fi case "$X11" in yes) exec vim -g $*;; no) exec open -a Vim $*;; esac
Another More Generic Script
This one is a simpler one than the gvim one but it is more generalized. It's not as pretty as the gvim one. Also is an alias so the DISPLAY veriable gets set properly (unline a script which only sets it locally.
This allows me to open an X11 app using `x' once or just typing `x' will start up the X11.app.
Here is my alias:
alias x='export DISPLAY=:0;Xapp'
and the Xapp program:
#!/bin/sh if [ -z "`ps ax | grep X11.app | grep -v grep`" ]; then open -a X11 sleep 5 fi if [ -n "$*" ]; then export DISPLAY=:0 exec $* else exit 0 fi |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|