On 2019-10-29 22:38, Vincent Lefevre wrote:
On 2019-10-29 14:32:39 +0900, John Crawley wrote:A (bash) script wants to put up a GUI (yad) if it can, or otherwise try to interact with the user on the terminal.
>> ---
loginctl show-session -p Type $XDG_SESSION_ID and looking for 'Type=x11' or 'Type=wayland'
>> ---
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.Actually they seem better as you can switch the X11 display (or disable it) by changing the value of $DISPLAY, and the GUI will probably honor this choice.
Thanks everybody for the feedback! I'll continue with the envvar test. -- John