Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Easier use of X11 in bash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easier use of X11 in bash
Authored by: virga42 on Oct 30, '03 01:30:07PM

I modified the script to:

#source .bashrc if it's there
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# if we're NOT ssh'd in
if [ ! ${SSH_TTY} ]; then
# make sure X is running
if [ "`ps -x | awk '{print $5}' | grep X11`" = "" ]; then
open /Applications/Utilities/X11.app
# then refocus Terminal.app
osascript -e 'tell application "Terminal" to activate'
fi
# if DISPLAY isn't set
if [ x${DISPLAY} = x ]; then
export DISPLAY=:0
fi
fi
# I like ls to color code my files
export CLICOLOR=1

I removed the "x"s in line 8 and adjusted the osascript line to make it a little more compact.

The problem I have found is that you regain focus of Terminal.app briefly and then X11.app steals focus back when it opens an xterm window.



[ Reply to This | # ]
Easier use of X11 in bash
Authored by: denken on Oct 30, '03 04:23:56PM

1. cp /etc/X11/xinit/xinitrc ~/.xinitrc

2. hash out the line that starts an xterm

Now you wont loose focus of Terminal.app when X11 starts. I think the whole idea here was to use Terminal.app instead of a regular xterm, but still have X11 running so you can launch X11 apps from Terminal.app.

Then again, maybe you have a reason to have an xterm open. Of course, if that is the case then you dont really need all this Terminal.app initialization stuff :)



[ Reply to This | # ]