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


Click here to return to the 'simpler tcsh version' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
simpler tcsh version
Authored by: jms1 on Sep 18, '05 04:33:02PM
I was already using the "xterm function" to keep the real xterm from running when X11 starts, but I had a hard-coded "setenv DISPLAY :0" in my .tcshrc. Reading the other replies here made me take another look at it- this is what I now have in my .tcshrc, it works like a charm.
if ( ! $?DISPLAY && ! $?SSH_TTY && ! $?REMOTEHOST ) then
        setenv DISPLAY `ps xw -o command | sed -n '/^\/.*X11.*\:/s/.*:/:/p'`
endif

if ( $?DISPLAY ) then
        xwininfo -display "$DISPLAY" -root >& /dev/null
        if ( $? ) then
                echo Unable to connect to X11 display \"$DISPLAY\"
                unsetenv DISPLAY
        else
                echo Using X11 display \"$DISPLAY\"
        endif 
endif


[ Reply to This | # ]
simpler tcsh version
Authored by: jms1 on Oct 01, '05 09:36:16AM
The "sed" pattern above is wrong... apparently the entry fields on this site interpret backslash "\" characters, and you have to enter them twice in order for the posted entry to contain them once. It should be...
'/^\/.*X11.*:/s/.*:/:/p'
Or... "forward slash, caret, backslash, forward slash, dot, star, X11..."

[ Reply to This | # ]