Xmonad

From ArchWiki
Revision as of 21:57, 30 March 2008 by Gwern (Talk | contribs) (Making room for conky or tray apps: oops, looks like there might be something in core to replace defaultGaps)

Jump to: navigation, search

Introduction

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

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

Installation

xmonad is currently available in the community repo. A build for the current development snapshot (darcs) is in the aur. The following instructions are for xmonad-darcs, the development snapshot.

Development Version (xmonad-darcs)

The xmonad-darcs development release requires 3 separate packages available from AUR (install them in the following order):

Configuration

Starting xmonad

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

Configuring xmonad

Xmonad uses a user-based configuration structure (<0.5 versions required the configuration to be compiled in like dwm). Users can now modify, override or extend the default settings with the ~/.xmonad/xmonad.hs configuration file. Recompiling is now done on the fly, with the Mod+q shortcut; no longer must you rebuild and reinstall packages just to change your preferences.

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:

Exiting xmonad

To end the current xmonad session, press Mod+SHIFT+q (Mod being ALT by default).

Tips & Tricks

Launching programs

By default, xmonad uses dmenu (installed as a dependency) for launching applications. dmenu can be invoked by pressing Mod+p (Mod being the ALT key by default). Enter the first few characters of the program and dmenu will narrow down the choices (press TAB for auto-completion).

For example, to launch Firefox press Alt+p to bring up dmenu, then type ' fir '. You will see firefox as one of the options; simply press the Enter key to load.

Making room for conky or tray apps

Note that 'defaultGaps' will be removed from XMonad in version 0.8, and replaced by something like 'avoidStruts' or an extension from XMonadContrib like XMonad.Hooks.ManageDocks.

xmonad can be configured to leave space at the top or bottom of your screen for background applications like Conky or trayer. To do so, open the Config.hs file in your favourite editor and change the defaultGaps value:

defaultGaps = [(0,0,0,0)]

The fields are: top, bottom, left, right. So, to leave a 15 pixel gap at the top and a 24 pixel gap along the bottom would look like this:

defaultGaps = [(15,24,0,0)]

Or, wrap your layouts with avoidStruts from XMonad.Hooks.ManageDocks for the fitting to happen automatically:

layoutHook = avoidStruts (tiled Tall ||| ...
manageHook = manageHook defaultConfig <+> manageDocks

If you ever want to toggle the gaps the action is

,((modMask x, xK_b     ), sendMessage ToggleStruts)

Dzen & conky-cli

conky-cli, a stripped-down version of the Conky status utility, can be used to pipe information directly to dzen for output in a statusbar. The following example displays the the loadavg values in red and the current time in the default dzen foreground colour:

~/.conkyrc:

background no
out_to_console yes
update_interval 1.0
total_run_times 0
use_spacer no

TEXT
^fg(#ff0000)${loadavg 1 2 3} ^fg()${time %a %b %d %I:%M%P}


~/bin/dzconky:

#!/bin/sh

FG='#aaaaaa'
BG='#1a1a1a'
FONT='-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*'
conky | dzen2 -e  -h '16' -w '600' -ta r -fg $FG -bg $BG -fn $FONT

Simply execute dzconky in your startup scripts.

Other Resources

xmonad -- The official xmonad website

xmonad: a guided tour

dzen -- A general purpose messaging and notification program

dmenu -- A dynamic X menu for the quick launching of programs