Re: shell script: test for graphical session

2019-10-29 Thread John Crawley
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 'T

Re: shell script: test for graphical session

2019-10-29 Thread Vincent Lefevre
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. > > Previously I was using loginctl: > loginctl show-session -p Type $XDG_SESSION_ID > and looking for 'Type=x11' or 'Type=waylan

Re: shell script: test for graphical session

2019-10-29 Thread Greg Wooledge
On Tue, Oct 29, 2019 at 02:32:39PM +0900, John Crawley wrote: > I've replaced the test with > [[ -n $DISPLAY || -n $WAYLAND_DISPLAY ]] && > 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

Re: shell script: test for graphical session

2019-10-29 Thread tomas
On Tue, Oct 29, 2019 at 02:32:39PM +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. > > Previously I was using loginctl: > loginctl show-session -p Type $XDG_SESSION_ID > and looking for 'Type=x11' or

shell script: test for graphical session

2019-10-28 Thread John Crawley
A (bash) script wants to put up a GUI (yad) if it can, or otherwise try to interact with the user on the terminal. Previously I was using loginctl: loginctl show-session -p Type $XDG_SESSION_ID and looking for 'Type=x11' or 'Type=wayland' However, if a user logs in on a tty and then runs 'star