Chapter 4. Using Cygwin/X

Table of Contents
Starting Cygwin/X
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 along with a single X terminal.

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 a single xterm.

Full documentation for startxwin can be read with man startxwin .

Starting an X desktop environment session in windowed mode

Several X desktop environments are packaged for Cygwin.

  • 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]

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.

Full documentation for xlaunch is available 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 options 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. Implementing this as a script made it difficult to reliably wait until the the X server had started before starting any clients. Use startxwin instead.

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).

  • startxwin exits after ~/.startxwinrc has completed and leaves X running, whereas startx waits until ~/.xinitrc exits (which is usually waiting for the window manager started by it to exit) and then kills X.

[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 /usr/bin/dbus-launch mate-session
or

echo "/usr/bin/dbus-launch startxfce4" > ~/.xinitrc
and then run 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 3, use the following command:

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