title: Determining if the user is running a graphical interface at the present tty
body: <p>Can a shell script determine whether the user is running a graphical interface at the same tty in which the user is working?</p>
  
  <p>Maybe this isn't even possible?</p>
  
  <p>EDIT:</p>
  
  <p>I'm actually trying to write a shell script that displays a GUI (by using zenity/yad) when the user is running a window manager on the same tty as the user is working on. Otherwise, the script falls back to a plain command line interface.</p>