[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: check if X is running?

I think another way to do it is to build two seperate binaries.  For
example, create xprog and prog, one that is X-only, and another that is
console-only.  This allows the user to specifcally set which version they
want, and it might also reduce the amount of code needed per program and
speed it up a bit.  Downside is, tho, you have to actually seperate the
code for both programs, and keep them updated at the same time (or just
share .c files... however you please.).  Anyway.  As far as detection, I
dunno, but hope this helps. 

Do Svidonia,

Martin Held
The way to love anything is to realize that it might be lost.

On Sun, 24 Jan 1999, Hamish Moffatt wrote:

> Can anyone suggest a good way to tell if the user is running a program from X?
> A program I maintain can run in terminal or graphical mode. It currently
> checks if graphics are available by comparing $TERM to a string
> included at compile time. That's "xterm" by default, which doesn't work
> on Debian because of "xterm-debian", and doesn't work in rxvt either.
> I'd like to remove that check and make it a better one. Is checking
> for $DISPLAY sufficient?

Reply to: