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
Hardware Accelerated OpenGL (AIGLX)
Input internationalization
Terminal Server or Fast User Switching

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 or a window manager) and performs X server configuration (for example, loading a keyboard modifier map).

Starting Cygwin/X in multiwindow mode (startxwin)

Use the custom XWin startup utility startxwin

startxwin is included in the xinit package (installed by following the instructions in the Section called Installing Cygwin/X in Chapter 2), which starts the X server in multiwindow mode along with a single X terminal. Run startxwin by:

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

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

    
$ startxwin
    

Full documentation for startxwin can be read with man startxwin . Note that the special option -- is used to mark the end of client options and the beginning of server options, so, for example, if you wish to start the X server with the -noclipboard option, as described in the Section called Command line parameters in Chapter 3, use the following command:


$ startxwin -- -noclipboard

You may create a ~/.startxwinrc script to customize the client programs started, rather than a single xterm.

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

Note: 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 XWin 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.

Note: 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.

Note: 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.

Starting Cygwin/X in windowed mode (startx)

Use the standard X Window System startx command with its attendant ~/.xinitrc configuration file.

Run startx in a Cygwin shell:


$ startx

Full documentation for startx can be read with man startx . Note that the special option -- is used to mark the end of client options and the beginning of server options, so, for example, if you wish to start the X server with the -emulate3buttons option, as described in the Section called Command line parameters in Chapter 3, use the following command:


$ startx -- -emulate3buttons

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.


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

Other startup methods

Advanced users may wish to start the X server by invoking XWin directly, for example, to start XDMCP sessions.