title: Opening Cygwin X11 applications in Windows 10 from desktop shortcuts
body: <p>I have 64-bit Cygwin installed on Windows 10, and I would like to open Cygwin GUI applications such as atril from desktop shortcuts, without having to open a Cygwin terminal and launching them from the command line manually.</p>
  <p>I have:</p>
  <ul>
  <li>created a ~/.startxwinrc file containing the line &quot;exec sleep infinity&quot;</li>
  <li>added these lines to ~/.bashrc</li>
  </ul>
  <blockquote>
  <p>export DISPLAY=:0.0</p>
  <p>which startxwin &gt; /dev/null 2&gt;&amp;1</p>
  <p>if [ $? -eq 0 ]; then</p>
  <pre><code>startxwin &gt; /dev/null 2&gt;&amp;1 &amp;
  </code></pre>
  <p>fi</p>
  </blockquote>
  <p>I can now open the applications by launching a Cygwin terminal, typing the name of the application, and pressing Enter. However, the desktop shortcuts I have created silently fail. One of these was:</p>
  <blockquote>
  <p>C:\cygwin64\bin\run.exe -p /bin xterm -display 0.0 -e /bin/bash -l /cygdrive/c/Users/MYNAME/atril-launcher.sh</p>
  </blockquote>
  <p>(I think that one failed because xterm and startxwin are incompatible; I may be wrong.)</p>
  <p>I have tried other command lines which include run.exe, but have been unable either to launch the application or to get a meaningful error message.</p>
  <p>atril-launcher.sh has the correct permissions, and contains the following text after the shebang (I couldn't get the formatting right trying to post the shebang in here.). It can be successfully launched from within the Cygwin terminal.</p>
  <blockquote>
  <p>nohup /bin/atril.exe &amp;</p>
  <p>sleep 3s</p>
  </blockquote>
  <p>I have searched the Internet for information on this problem, much of which is out of date (Cygwin now using /bin instead of /usr/bin, Cygwin no longer having an X11R6 folder, DISPLAY=:0.0 instead of DISPLAY=localhost:0.0, etc...) but at this point I'm at my wits' end.</p>