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

Re: shell script: test for graphical session



On Tue, Oct 29, 2019 at 02:32:39PM +0900, John Crawley wrote:
> I've replaced the test with
> [[ -n $DISPLAY || -n $WAYLAND_DISPLAY ]] && <use GUI>
> but environment variables are a bit fragile and I was wondering if there
> might be a better way.

Nope.  This is it.

If your user sets the DISPLAY variable by hand, and the software fails,
then it's the user's fault.  That's the beauty of Unix: if the end user
screws something up, you get to blame them for their mistakes instead
of having to coddle them and work around their foolishness.


Reply to: