07 June 2015
When I first started using cygwin I didn’t really see much sense in having X windows, within MS Windows. I think that’s because for those of us who became familiar with Linux via desktop environments had limited exposure to the origins of X and some of the things it was intended to achieve - distributed GUI applications on client machines, run off a central server. So when you ssh into a computer, and they both have X servers, and you’re using the -X switch to enable port forwarding, you will get the GUI on your computer, while the program runs on the server.
ssh -X email@example.com # Then run a graphical program with an ampersand to put the job in the background. xterm &
Installing X in Cygwin is just a case of going into the X11 menu and selecting a bunch of stuff. You’ll get a better environment by selecting more of it, and in that spirit I select the following. They are in one line without punctuation so you can paste them into an apt-cyg command if desired:
bigreqsproto bitmap compositeproto cygutils-x11 cygwin-x-doc damageproto dmxproto fixesproto fontconfig fontsproto fonttosfnt harfbuzz kbproto mkfontdir mkfontscale rendercheck renderproto resourceproto rgb rstart sessreg shared-mime-info twm xauth xbitmaps xcb-proto xclipboard xclock xcmiscproto xcmsdb xcommgr xconsole xcursor-themes xcursor-gen xdpyinfo xfd xfontsel xhost xinit xinput xkbcomp xkbevd xkbprint xkbutils xkeyboard-config xkill xlaunch xload xloadimage xmessage xorg-server xorg-server-extra xprop xrandr xrefresh xscope xset xsetroot xsm xsdtdcmap xterm XtoW xwinclip xwininfo
And install font-* (all of them)
If you want a lighter (less awesome) approach, try downloading Xming and running that instead. Regardless of the approach you take, you’ll want to add the following into your .bashrc:
At this stage you can start up X in it’s own window with ‘startx’ and it’ll look something like this:
For something more usable, start it with:
# You can look up more switches with 'man XWin', but the defaults are pretty good XWin -multiwindow
You should now have an icon in your taskbar like this , which you can right-click to start xterms, etc. More importantly, you now have an xserver to run forwarded X11 applications, or launch GUIs for anything else you might have installed.
In Windows 7, create a new shortcut by right-clicking on the windows desktop and selecting New > Shortcut. Put in the following as your program, with alterations if you installed in a different place.
C:Cygwinbinrun.exe -p /usr/bin XWin -multiwindow -silent-dup-error
Save the shortcut with a name like XWin, then go to Start > All Programs > Startup, right-click on the folder and choose open. Then move the shortcut in there, and voila!
Windows 8 follows a similar proceedure, but to find the startup folder, you’ll need to press Win + R, then type in %AppData%MicrosoftWindowsStart MenuProgramsStartup