xmonad is written, configured and extensible in [http://haskell.org/ Haskell]. Custom layout algorithms, key bindings and other extensions may be written by the user in config files.

xmonad is written, configured and extensible in [http://haskell.org/ 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.

+

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.

For more information, please visit the xmonad website: http://xmonad.org/

For more information, please visit the xmonad website: http://xmonad.org/

Line 44:

Line 45:

mkdir ~/.xmonad

mkdir ~/.xmonad

−

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

+

See [[xinitrc]] for details, such as preserving the logind session.

===Configuring xmonad===

===Configuring xmonad===

Line 67:

Line 68:

import XMonad

import XMonad

−

main = do

+

main = xmonad defaultConfig

−

xmonad $ defaultConfig

{ terminal = "urxvt"

{ terminal = "urxvt"

, modMask = mod4Mask

, modMask = mod4Mask

Line 125:

Line 125:

===Exiting xmonad===

===Exiting xmonad===

−

To end the current xmonad session, press {{Keypress|Mod+Shift+Q}}. By default, {{Keypress|Mod}} is the {{Keypress|Alt}} key.

+

To end the current xmonad session, press {{ic|Mod+Shift+Q}}. By default, {{ic|Mod}} is the {{ic|Alt}} key.

==Tips and tricks==

==Tips and tricks==

+

===X-Selection-Paste===

The keyboard-centered operation in Xmonad can be further supported with a keyboard shortcut for [[Keyboard_Shortcuts#Key_Binding_for_X-Selection-Paste|X-Selection-Paste]].

The keyboard-centered operation in Xmonad can be further supported with a keyboard shortcut for [[Keyboard_Shortcuts#Key_Binding_for_X-Selection-Paste|X-Selection-Paste]].

+

+

Also, there exists a function "pasteSelection" in Xmonad.Util.Paste that can be bound to a key using a line like:

+

{{hc|xmonad.hs|

+

-- X-selection-paste buffer

+

, ((0, xK_Insert), pasteSelection)}}

+

Pressing the "Insert" key will now paste the mouse buffer in the active window.

===Complementary applications===

===Complementary applications===

Line 229:

Line 236:

Firstly, you can use the following xmonad extension, [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-ServerMode.html XMonad.Hooks.ServerMode].

Firstly, you can use the following xmonad extension, [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-ServerMode.html XMonad.Hooks.ServerMode].

−

Secondly, you can simulate keypress events using {{Pkg|xdotool}} or similar programs. See this [http://ubuntuforums.org/archive/index.php/t-658040.html Ubuntu forums thread]. The following command would simulate the keypress {{Keypress|Super+n}}:

+

Secondly, you can simulate keypress events using {{Pkg|xdotool}} or similar programs. See this [http://ubuntuforums.org/archive/index.php/t-658040.html Ubuntu forums thread]. The following command would simulate the keypress {{ic|Super+n}}:

xdotool key Super+n

xdotool key Super+n

Line 264:

Line 271:

</nowiki>}}

</nowiki>}}

−

Just remember to add a comma before or after and change the path to your actual script path. Now just {{Keypress|Mod+q}} (restart xmonad to refresh the config), and then hit {{Keypress|Mod+Shift+o}} 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 {{ic|~/.xmonad/xmonad.hs}} which uses this setup [http://www.haskell.org/haskellwiki/Xmonad/Config_archive/adamvo%27s_xmonad.hs Adamvo's xmonad.hs]

+

Just remember to add a comma before or after and change the path to your actual script path. Now just {{ic|Mod+q}} (restart xmonad to refresh the config), and then hit {{ic|Mod+Shift+o}} 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 {{ic|~/.xmonad/xmonad.hs}} which uses this setup [http://www.haskell.org/haskellwiki/Xmonad/Config_archive/adamvo%27s_xmonad.hs Adamvo's xmonad.hs]

===Example configurations===

===Example configurations===

Line 374:

Line 381:

There are several things that may help:

There are several things that may help:

−

* 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}}, uncomment the line {{Ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}} in {{ic|/etc/profile.d/jre.sh}}. Then, source the file {{ic|/etc/profile.d/jre.sh}} or log out and log back in.

−

* 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 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"

Line 383:

Line 389:

===Empty space at the bottom of gvim or terminals===

===Empty space at the bottom of gvim or terminals===

−

See [[Vim#Empty space at the bottom of gvim windows]] for a solution which makes the area match the background color.

+

See [[Vim#Empty space at the bottom of gVim windows]] for a solution which makes the area match the background color.

For [[rxvt-unicode]], you can use {{AUR|rxvt-unicode-patched}}.

For [[rxvt-unicode]], you can use {{AUR|rxvt-unicode-patched}}.

Line 390:

Line 396:

===Chromium/Chrome will not go fullscreen===

===Chromium/Chrome will not go fullscreen===

−

If Chrome fails to go fullscreen when {{Keypress|F11}} is pressed, you can use the [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html XMonad.Hooks.EwmhDesktops] extension found in the {{Pkg|xmonad-contrib}} package. Simply add the {{ic|import}} statement to your {{ic|~/.xmonad/xmonad.hs}}:

+

If Chrome fails to go fullscreen when {{ic|F11}} is pressed, you can use the [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html XMonad.Hooks.EwmhDesktops] extension found in the {{Pkg|xmonad-contrib}} package. Simply add the {{ic|import}} statement to your {{ic|~/.xmonad/xmonad.hs}}:

import XMonad.Hooks.EwmhDesktops

import XMonad.Hooks.EwmhDesktops

Line 403:

Line 409:

</nowiki>}}

</nowiki>}}

−

After a recompile/restart of xmonad, Chromium should now respond to {{Keypress|F11}} (fullscreen) as expected.

+

After a recompile/restart of xmonad, Chromium should now respond to {{ic|F11}} (fullscreen) as expected.

===Multitouch / touchegg===

===Multitouch / touchegg===

Line 410:

Line 416:

===Keybinding issues with an azerty keyboard layout===

===Keybinding issues with an azerty keyboard layout===

Users with a keyboard with azerty layout can run into issues with certain keybindings. Using the [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Config-Azerty.html XMonad.Config.Azerty] module will solve this.

Users with a keyboard with azerty layout can run into issues with certain keybindings. Using the [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Config-Azerty.html XMonad.Config.Azerty] module will solve this.

A known issue with Virtualbox ([https://www.virtualbox.org/ticket/6479 Ticket #6479]) can cause problems with the focused window border. A solution can be found by installing a compositing manager like [[xcompmgr]] which overrides the incorrect behavior of vboxvideo.

+

+

===Steam games (Half-Life, Left 4 Dead, …) and xmonad===

+

There seems to be some trouble with Source engine based game (like Half-Life). If they don't start or get stuck with a black screen a workaround it to start them in window mode: right click on the game in your library and choose properties, click on launch options and enter

Revision as of 20:06, 10 October 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:

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.

Controlling xmonad with external scripts

Secondly, you can simulate keypress events using xdotool or similar programs. See this Ubuntu forums thread. The following command would simulate the keypress Super+n:

xdotool key Super+n

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 Mod+q (restart xmonad to refresh the config), and then hit Mod+Shift+o 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 jre7-openjdk, uncomment the line export _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh. Then, source the file /etc/profile.d/jre.sh or log out and log back in.

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

Chromium/Chrome will not go fullscreen

If Chrome fails to go fullscreen when F11 is pressed, you can use the XMonad.Hooks.EwmhDesktops extension found in the xmonad-contrib package. Simply add the import statement to your ~/.xmonad/xmonad.hs:

import XMonad.Hooks.EwmhDesktops

and then add handleEventHook = fullscreenEventHook to the appropriate place; for example:

After a recompile/restart of xmonad, Chromium should now respond to F11 (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.

If you do not need the capability to switch the display-setup in the gnome-control-center, just execute

dconf write /org/gnome/settings-daemon/plugins/xrandr/active false

as your user, to disable the xrandr plugin which grabs Super+p.

Problems with focused border in VirtualBox

A known issue with Virtualbox (Ticket #6479) can cause problems with the focused window border. A solution can be found by installing a compositing manager like xcompmgr which overrides the incorrect behavior of vboxvideo.

Steam games (Half-Life, Left 4 Dead, …) and xmonad

There seems to be some trouble with Source engine based game (like Half-Life). If they don't start or get stuck with a black screen a workaround it to start them in window mode: right click on the game in your library and choose properties, click on launch options and enter