Chapter 3. Using Cygwin/X

Table of Contents
Starting Cygwin/X
Displaying local clients
Switching out of Cygwin/X
Stopping Cygwin/X
Window managers
Windows Clipboard integration
Shared memory support
Displaying remote clients
Remote sessions via XDMCP
OpenGL (GLX)
Input internationalization
Terminal Server or Fast User Switching
Customizing the notification area icon menu

Starting Cygwin/X

Described below are several methods of starting up the Cygwin/X X Server with a startup utility that optionally starts initial clients (for example, a terminal, a window manager, or a desktop environment) and performs X server configuration (for example, loading a keyboard map).

Starting in multiwindow mode (startxwin)

The custom XWin startup utility startxwin [1] starts the X server in multiwindow mode.

startxwin is included in the xinit package (installed by following the instructions in the Section called Installing Cygwin/X in Chapter 2).

Run startxwin by: [2]

  • using the "XWin Server" shortcut under "Cygwin-X" on the Start Menu

  • Starting /usr/bin/startxwin in a Cygwin shell:

    
$ startxwin
    

You may create a ~/.startxwinrc script to customize the client programs started, rather than using the default /etc/X11/xinit/startxwinrc script.

Full documentation for startxwin can be read with man startxwin .

Starting an X desktop environment session or X window manager in windowed mode

Several X desktop environments are packaged for Cygwin.

  • GNOME Flashback Desktop Environment: install the gnome-flashback package

  • KDE Plasma Desktop Environment: install the kde-workspace package

  • LXDE Desktop Environment: install the lxde-common package

  • LXQT Desktop Environment: install the lxqt-session package

  • MATE Desktop Environment: install the mate-session-manager package

  • Xfce Desktop Environment: install the xfce4-session package

and use the provided Start Menu shortcut. [3]

Several X window managers are packaged for Cygwin.

  • aewm++ window manager: install the aewm++ package

  • dwm window manager: install the dwm package

  • FVWM window manager: install the fvwm package

  • Openbox window manager: install the openbox package

  • twm window manager: install the twm package

  • WindowMaker window manager: install the WindowMaker package

Starting an X session with XLaunch

XLaunch is a GUI wizard for starting the Cygwin/X X server and a local or remote X client. These sessions can be saved and shared as .xlaunch files.

XLaunch is included in the xlaunch package (installed by following the instructions in the Section called Installing Cygwin/X in Chapter 2).

Run xlaunch using the "XLaunch" shortcut under "Cygwin-X" on the Start Menu.

Documentation for xlaunch is available at http://x.cygwin.com/docs/xlaunch/ and as online help within the program.

Starting in windowed mode (startx)

Use the standard X Window System startx command and its associated ~/.xinitrc configuration file.

Run startx in a Cygwin shell:


$ startx

Full documentation for startx can be read with man startx .

You may create a ~/.xinitrc from the template in /etc/X11/xinit/xinitrc and then customize ~/.xinitrc to start client programs and configure your X server.


$ cp /etc/X11/xinit/xinitrc ~/.xinitrc
[edit ~/.xinitrc as desired]

Note: startx waits until ~/.xinitrc exits (which is often waiting for a window manager started by it to exit) and then kills X, so the last client started by should be started with exec and without &.

Alternatively, if you just want to start a single client program (perhaps a window manager), you don't need to use a ~/.xinitrc, and can start the client directly from startx, e.g. [4]


$ startx /usr/bin/fvwm2

Note: The client name supplied to startx must begin with / or ., otherwise it is treated as an option to the default xterm client.

Notes for advanced users

Advanced users may wish to start the X server by invoking XWin directly, for example, to start XDMCP sessions (See the Section called Remote sessions via XDMCP).

If you want to have a Start Menu shortcut which runs startxwin with custom options, you should use a copy of the Start Menu shortcut installed by xinit, so that your changes are not overwritten when the xinit package is updated.

Obsolete startup methods

The MS-DOS batch file startxwin.bat and bash shell script startxwin.sh previously used to start the X server are no longer provided. This implementation made it difficult to reliably wait until the the X server had started before starting any clients. Use startxwin instead.

The executable startxwin.exe previously used to start the X server has been retired and replaced with a shell script startxwin.

Notes

[1]

startxwin is a specialized version of startx with a few differences appropriate to running in multiwindow mode, rather than windowed mode.

  • startxwin supplies the -multiwindow option to X

  • It uses a different script to start clients (~/.startxwinrc rather than ~/.xinitrc), because ~/.xinitrc will normally end by starting a window manager, which would be incorrect for ~/.startxwinrc (as it would discover the internal window manager is already running and exit immediately).

  • Note that startxwin no longer exits after ~/.startxwinrc has completed, leaving X running, but, similar to startx, waits until ~/.startxwinrc exits and then kills X.

    If you don't want the X server to exit until explicitly told to do so, end your ~/.startxwinrc with something like exec sleep infinity.

[2]

It's not recommended to start startxwin from a MS-DOS shell or by double-clicking it in Windows Explorer. To do so means that the X server is not started from a login shell, and programs started from the notification area icon menu will not inherit the environment of a login shell. This may lead to unexpected behaviour, for example, if you have customizations to your login shell start-up scripts which set environment variables.

[3]

Alternatively, these sessions can be started from the command line, e.g.

startx /etc/X11/xinit/Xsession mate
or

echo "/etc/X11/xinit/Xsession xfce" > ~/.xinitrc
and then running startx.

[4]

Note that startxwin and startx use the special option -- to mark the end of client options and the beginning of server options, So, for example, if you wish to also start the X server with the options -emulate3buttons and -noclipboard, as described in the Section called Command line parameters in Chapter 4, use the following command:

$ startx /usr/bin/fvwm2 -- -emulate3buttons -noclipboard