Reputation: 1763
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.
I have:
export DISPLAY=:0.0
which startxwin > /dev/null 2>&1
if [ $? -eq 0 ]; then
startxwin > /dev/null 2>&1 &
fi
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:
C:\cygwin64\bin\run.exe -p /bin xterm -display 0.0 -e /bin/bash -l /cygdrive/c/Users/MYNAME/atril-launcher.sh
(I think that one failed because xterm and startxwin are incompatible; I may be wrong.)
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.
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.
nohup /bin/atril.exe &
sleep 3s
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.
Upvotes: 1
Views: 1594
Reputation: 1763
It looks as though I've found a partial answer to my own question. It's imperfect for various reasons:
It probably depends on startxwin already having been launched elsewhere as a background process.
The applications are slow to launch; there's a delay of a few seconds.
Terminal windows which the user cannot interact with (presumably the shells which act as parent process for the GUI applications) appear alongside the application windows.
But it will probably be enough to be getting on with. Assuming pluma to be our application, here is the shortcut that successfully launches it:
C:\cygwin64\bin\mintty.exe /bin/bash -l -c "export DISPLAY=:0.0; pluma"
I'd like to thank the author of answer https://stackoverflow.com/a/12215570/9223868 - which I did not find through googling, only through its appearing in the "Related" list when this was posted.
Upvotes: 1