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

check if X is running?

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?

Hamish Moffatt VK3TYD              hamish@debian.org, hamish@rising.com.au
Latest Debian packages at ftp://ftp.rising.com.au/pub/hamish. PGP#EFA6B9D5
CCs of replies from mailing lists are welcome.   http://hamish.home.ml.org

Reply to: