Xmonad/Frequently asked questions
xmonad: frequently asked questions
- 1 What build dependencies does xmonad have?
- 2 Can I install without root permission?
- 3 How do I configure xmonad?
- 4 Does xmonad support a statusbar?
- 5 How can I use xmonad with a display manager? (xdm, kdm, gdm)
- 6 Using a dock client
- 7 X11 fails to find libX11 or libXinerama
- 8 xmonad does not detect my multi-head setup
- 9 Main.hs:175:8: Not in scope: data constructor `ConfigureEvent'
- 10 Missing X11 headers
- 11 Rebinding the mod key
- 12 Saving layout
- 13 Startup programs
- 14 Losing text when resizing xterms
- 15 Dynamic restart
- 16 Some keys not working
- 17 Firefox's annoying popup downloader
- 18 Copy and Paste on the Mac
- 19 Building xmonad with GHC 6.8
- 20 Setting the X cursor
- 21 Problems with Java applications
- 22 Compiling xmonad on PowerPC and compiler is not interactive
- 23 Cabal: Executable stanza starting with field 'flag small_base description'
- 24 Changes to the config file ignored
What build dependencies does xmonad have?
The [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad hackage page for xmonad] lists all dependencies, including:
- Haskell X11 bindings:
- C libraries:
You likely have these already if you've built any programs for X.
Can I install without root permission?
Yes, the Haskell libraries that xmonad depends on can all by installed in the user package database. Simply append --user to the install phase:
$ runhaskell Setup.hs install --user
The library will be registered in your ~/.ghc/ database.
How do I configure xmonad?
By editing the Config.hs file, a Haskell source file. You can use any Haskell you want in this module. To have your changes take effect, recompile xmonad, reinstall it, and either restart (mod-q) or exit X, and log back in.
Example configurations are available on the wiki.
Note that when reinstalling, cabal might prevent you from overwriting the running xmonad binary:
Installing: /home/dons/lib/xmonad-0.2/ghc-6.6 & /home/dons/bin xmonad-0.2... copy /usr/obj/cabal/xmonad/xmonad to /home/dons/bin/xmonad *** Exception: /home/dons/bin/xmonad: copyFile: resource busy (Text file busy)
The solution is to remove the old xmonad binary before install.
rm `which xmonad`
This is not required if you're using newer Cabal versions.
Does xmonad support a statusbar?
xmonad lets you use any application as a 'statusbar', as long as it is visible in a given 'gap' on the screen, and has the override-redirect property set to true. Many status bar/dock programs already set this property, for example, dzen. To set other applications, you can sometimes use normal X resources. For example, to use xclock, launch it with
xclock -digital -xrm '*overrideRedirect: True' -geometry 1024x30+0+0
And set a gap of (30,0,0,0) in Config.hs. A similar trick can be done for xsystray.
You can see screenshots of statusbars on the screenshots page.
How can I use xmonad with a display manager? (xdm, kdm, gdm)
The simplest way is to create or modify your ~/.xsession file to run xmonad. If you don't already have a .xsession, the minimal example looks like:
This requires that the xmonad executable (or a symlink to it) is in a directory in your $PATH. Alternatively, you can use the full path to xmonad. People using 'startx' can use these example xinitrc and run-xmonad scripts.
If you are using xdm, you're done. Login and enjoy xmonad.
If you're using kdm or gdm (KDE and GNOME's display mangers, respectively), you're almost done. When logging in, select the entry that says "xsession" or "default session" from the menu in order to use your ~/.xsession to start xmonad.
Alternatively, if you want a menu entry specifically for xmonad, create a file named "xmonad.desktop" in your /usr/share/xsessions (location varies by distribution) directory. For example:
[Desktop Entry] Encoding=UTF-8 Name=xmonad Comment=This session starts xmonad Exec=/usr/local/bin/xmonad Type=Application
Replace the "Exec=..." line with the actual path to your xmonad executable, and you should be able to login by selecting "xmonad" as a session from the menu in gdm/kdm.
For instructions on using gdm to launch a full GNOME session with xmonad as the window manager read this.
Using a dock client
As of version 0.2, dock clients (such as gkrellm) aren't specially supported. They will be treated as a normal window. It is possible to use them by explicitly unmanaging the window, after moving it into a gap space. Dock clients are fully supported in version 0.4 and later.
X11 fails to find libX11 or libXinerama
Cabal has difficulty locating library directories on some platforms (such as the Mac or RHEL4). First, locate the directory that contains libX11.so (libX11.dylib on Mac OS X). Add the following line to the .cabal file for the package:
For example, on a 64 bit machine you might need to add:
You can also add the paths to your .buildinfo file, or set the LD_LIBRARY_PATH environment variable.
xmonad does not detect my multi-head setup
You may not have the Xinerama development files installed, install them, then watch the configure output for X11. Look for the following lines:
checking X11/extensions/Xinerama.h usability... yes checking X11/extensions/Xinerama.h presence... yes checking for X11/extensions/Xinerama.h... yes
Be sure to clean and rebuild xmonad after building and installing X11.
Main.hs:175:8: Not in scope: data constructor `ConfigureEvent'
When building a darcs version of xmonad, you may also need to use a darcs version of the X11 library. That is available from:
darcs get http://darcs.haskell.org/X11
Missing X11 headers
Your build will fail if you've not installed the X11 C library headers at some point. ./configure for the Haskell X11 library will fail. To install the X11 C libs:
apt-get install libx11-dev
Rebinding the mod key
xmonad uses 'alt', actually mod1, as the default modifier. You may bind to other mod keys by editing Config.hs' modMask value, or by using xmodmap to rebind a key to mod1. The apple command key can be rebound to mod1 in this way. Use xmodmap to find what key your mod1 is bound to, as well.
You can rebind the Caps Lock key, to mod, if you wish. See this mailing list item.
If your new key binding doesn't appear to work, double check it doesn't clash with an existing binding.
xmonad will remember your workspace layouts during dynamic restart (mod-q), but not when quitting X altogether. Note that this means if you add or remove layouts to the config.hs file, the changes won't be noticed during a hot-restart (the state from the previous session will be used).
You can reinitialise the xmonad state dynamically with mod-space.
You may launch programs at startup in the usual X manner: by adding them to your .xsession or .Xinitrc. For example, the following .xsession file launches 'unclutter' to hide the cursor, xpmroot to set the background image, xmodmap to rebind caps lock to ctrl. It then launches a status bar program with dzen, before finally launching xmonad:
# .xsession unclutter -idle 1 & xpmroot ~/.bg/407511721_eb8559457c_o.xpm & xrdb -merge .Xresources
xmodmap -e "remove Lock = Caps_Lock" xmodmap -e "keysym Caps_Lock = Control_L" xmodmap -e "add Control = Control_L"
status | dzen2 -ta r -fg '#a8a3f7' \ -bg '#3f3c6d' \ -fn '-*-terminus-medium-r-normal--16-*' \ -e "button1=exec:xterm" & urxvt &
Losing text when resizing xterms
Being a dynamic tiling window manager, xmonad, like ion or dwm, makes heavy use of resizing. Poor clients such as xterm, might not take well to resizing and will require explicit resize events to be sent (Ctrl-L). This however, can cause the buffer to be cleared. To avoid this, several users recommend urxvt (rxvt-unicode), which handles resizing much better.
The dynamic reconfigure and restart feature (mod-q) assumes that xmonad is in your $PATH environment. If it isn't, restarting will have no effect.
Some keys not working
If you've an unusual keyboard, X may not know precisely which keys you've bound xmonad actions to. An example is when you've use a French keyboard. You may need to set your own mod key, or use different key bindings in Config.hs. See this thread for advice on rebindings keys.
Firefox's annoying popup downloader
Some applications, notably Firefox 1 and 2, create tranisent windows not set with the transient property. (e.g. firefox's download manager). When these windows appear, they can take focus and be annoying. For the case of firefox, the 'Download Statusbar' extension is useful for disabling this annoying UI feature.
Copy and Paste on the Mac
When using X11 for Mac OS X, and you switch from the quartz WM to xmonad, you can lose copy/paste functionality between X windows and normal Mac apps. To fix this, and restore copy and paste, add
quartz-wm --only-proxy &
in your .xinitrc above the line that runs xmonad. It will capture and syncronize copy/paste events in both environments. More specifically, it mirrors OS X copy actions into both PRIMARY and CLIPBOARD, but only CLIPBOARD into OS X paste.
Building xmonad with GHC 6.8
The ghc version 6.8 uses a smaller base library, with some modules xmonad depends on moved into the 'containers' package. Additionally, some language extension flags have changed.
To build xmonad 0.4 with ghc 6.8, you'll need to amend your .cabal file slightly, to something like:
-build-depends: base>=2.0, X11>=1.3.0, mtl>=1.0, unix>=1.0 +build-depends: base>=2.0, X11>=1.3.0, mtl>=1.0, unix>=1.0, containers
-ghc-options: -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s +ghc-options: -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s -XPatternGuards -XExistentialQuantification -XMultiParamTypeClasses -XTypeSynonymInstances -fglasgow-exts
Alternatively, you can update to cabal 1.2, and use a version of xmonad more recent than 0.4, which will build with either ghc 6.6.x or ghc 6.8.
Setting the X cursor
By default xmonad doesn't set a particular X cursor, which usually means the default X cursor will be used by the system. To set your own custom cursor, use the xsetroot program, as follows, from your startup file:
xsetroot -cursor_name left_ptr
For example, to get nice left-pointing arrow head cursor.
Problems with Java applications
The Java gui toolkit has a hardcoded list of so-called "non-reparenting" window managers. xmonad is not on this list (nor are many of the newer window managers). Attempts to run Java applications may result in `grey blobs' where windows should be, as the Java gui code gets confused.
To work around this silly restriction, you can attempt to fake the window manager used by setting the environment variable:
This seems to fix at least MATLAB and cgoban3. It also fixes an issue with Java gui applications where menus are not "selectable". Clicking on the menu item opens the dropdown list of options but you can't select one.
Using the free blackdown java runtime also seems to work correctly.
Compiling xmonad on PowerPC and compiler is not interactive
If you have ghc installed and are trying to compile xmonad and your compiler complains about not being interactive, never fear. To compile Setup.hs simply type:
ghc --make Setup.hs -o Setup
Now you can:
./Setup configure ./Setup build sudo ./Setup install
If during the build process ghc complains about the "impossible happening", and mentions that you should change something to "-fvia-C", just edit the *.cabal file replacing the line that sets the arguments for ghc, changing "-fasm" to "-fvia-C".
Cabal: Executable stanza starting with field 'flag small_base description'
The darcs version after xmonad 0.4 switched to requiring Cabal 1.2 to build xmonad. You must have Cabal 1.2 or newer to build xmonad older than 0.4. It will work fine with ghc 6.6.1, and you do not need to updated ghc. Get cabal from Hackage:
Build and install as usual, then rebuild xmonad.
To build Cabal with ghc 6.6.1 you will also need the filepath library, which is also (of course) available from hackage:
Changes to the config file ignored
Both ghc and xmonad must be in your $PATH for reconfiguration to work.
When changing the config.hs (0.4) or xmonad.hs (0.5) and restarting with mod-q, xmonad will attempt to exec the xmonad binary. This means it must be in your $PATH environment variable, or the exec will fail silently and the old xmonad instance keeps running.
With xmonad 0.5 and later, mod-q will also call ghc on your ~/.xmonad/xmonad.hs file, and will continue with defaults if ghc is not found.