* If you are using {{Pkg|openjdk6}}, you can export {{Ic|_JAVA_AWT_WM_NONREPARENTING<nowiki>=</nowiki>1}} in {{ic|/etc/profile.d/openjdk6.sh}}.

* If you are using {{Pkg|openjdk6}}, you can export {{Ic|_JAVA_AWT_WM_NONREPARENTING<nowiki>=</nowiki>1}} in {{ic|/etc/profile.d/openjdk6.sh}}.

−

* If you are using {{Pkg|jre7-openjdk}}, you can export {{Ic|_JAVA_AWT_WM_NONREPARENTING<nowiki>=</nowiki>1}} in {{ic|/etc/profile.d/jre.sh}}.

+

* If you are using {{Pkg|jre7-openjdk}}, you can export {{Ic|_JAVA_AWT_WM_NONREPARENTING<nowiki>=</nowiki>1}} in {{ic|/etc/profile.d/jre.sh}}. Don't forget to restart.

* If you are using Oracle's JRE/JDK, the best solution is usually to use [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html SetWMName.] However, its effect may be nullified if one also uses XMonad.Hooks.EwmhDesktops, in which case

* If you are using Oracle's JRE/JDK, the best solution is usually to use [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html SetWMName.] However, its effect may be nullified if one also uses XMonad.Hooks.EwmhDesktops, in which case

>> setWMName "LG3D"

>> setWMName "LG3D"

Revision as of 10:21, 14 March 2013

zh-CN:Xmonadxmonad is a tiling window manager for X. Windows are arranged automatically to tile the screen without gaps or overlap, maximizing screen use. Window manager features are accessible from the keyboard: a mouse is optional.

xmonad is written, configured and extensible in Haskell. Custom layout algorithms, key bindings and other extensions may be written by the user in config files.

Layouts are applied dynamically, and different layouts may be used on each workspace. Xinerama is fully supported, allowing windows to be tiled on several physical screens.

Configuration

Starting xmonad

To start xmonad automatically, simply add the command xmonad to your startup script (e.g. ~/.xinitrc if you use startx, ~/.xsession if you use xdm login manager). GDM and KDM users can create a new session file and then select xmonad from the appropriate Session menu.

Note: By default, xmonad does not set an X cursor, therefore the "cross" cursor is usually displayed which can be confusing for new users (thinking that xmonad has not launched correctly). To set the expected left-pointer, add the following to your startup file (e.g. ~/.xinitrc):

xsetroot -cursor_name left_ptr

Also, xmonad defaults to the U.S. keyboard layout, so if you want, for example, the German keyboard layout, add the following to ~/.xinitrc or read more about setting keyboard layouts here:

If, for some reason, xmonad does not start, check if you have an .xmonad directory in your home directory. If not, create it:

mkdir ~/.xmonad

See xinitrc for details, such as preserving the logind (and/or consolekit) session.

Configuring xmonad

xmonad users can modify, override or extend the default settings with the ~/.xmonad/xmonad.hs configuration file. Recompiling is done on the fly, with the Mod+q shortcut.

If you find you do not have a directory at ~/.xmonad, run xmonad --recompile to create it.

The "default config" for xmonad is quite usable and it is achieved by simply running without an xmonad.hs entirely. Therefore, even after you run xmonad --recompile you will most likely not have an ~/.xmonad/xmonad.hs file. If you would like to start tweaking things, simply create the file and edit it as described below.

Because the xmonad configuration file is written in Haskell, non-programmers may have a difficult time adjusting settings. For detailed HOWTO's and example configs, we refer you to the following resources:

This simply overrides the default terminal and borderWidth while leaving all other settings at their defaults (inherited from the function defaultConfig).

As things get more complicated, it can be handy to call configuration options by function name inside the main function, and define these separately in their own sections of your ~/.xmonad/xmonad.hs. This makes large customizations like your layout and manage hooks easier to visualize and maintain.

Launching another window manager within xmonad

If you are using xmonad-darcsAUR, as of January of 2011, you can restart to another window manager from within xmonad. You just need to write a small script, and add stuff to your ~/.xmonad/xmonad.hs. Here is the script.

~/bin/obtoxmd

#!/bin/sh
openbox
xmonad

And here are the modifications you need to add to your ~/.xmonad/xmonad.hs:

Just remember to add a comma before or after and change the path to your actual script path. Now just Template:Keypress (restart xmonad to refresh the config), and then hit Template:Keypress and you should have Openbox running with the same windows open as in xmonad. To return to xmonad you should just exit Openbox. Here is a link to adamvo's ~/.xmonad/xmonad.hs which uses this setup Adamvo's xmonad.hs

Missing xmonad-i386-linux or xmonad-x86_64-linux

Xmonad should automatically create the xmonad-i386-linux file (in ~/.xmonad/). If this it not the case you can grab a cool looking config file from the xmonad wiki or create your own. Put the .hs and all others files in ~/.xmonad/ and run this command from the folder:

xmonad --recompile

Now you should see the file.

Note: A reason you may get an error message saying that xmonad-x86_64-linux is missing is that xmonad-contrib is not installed.

Problems with Java applications

The standard Java GUI toolkit has a hard-coded list of "non-reparenting" window managers. Since xmonad is not in that list, there can be some problems with running some Java applications. One of the most common problems is "gray blobs", when the Java application renders as a plain gray box instead of rendering the GUI.

There are several things that may help:

If you are using openjdk6, you can export _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/openjdk6.sh.

If you are using jre7-openjdk, you can export _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh. Don't forget to restart.

If you are using Oracle's JRE/JDK, the best solution is usually to use SetWMName. However, its effect may be nullified if one also uses XMonad.Hooks.EwmhDesktops, in which case

After a recompile/restart of xmonad, Chromium should now respond to Template:Keypress (fullscreen) as expected.

Multitouch / touchegg

Touchégg polls the window manager for the _NET_CLIENT_LIST (in order to fetch a list of windows it should listen for mouse events on.) By default, xmonad does not supply this property. To enable this, use the XMonad.Hooks.EwmhDesktops extension found in the xmonad-contrib package.

Keybinding issues with an azerty keyboard layout

Users with a keyboard with azerty layout can run into issues with certain keybindings. Using the XMonad.Config.Azerty module will solve this.