I’ve spent a lot of time perfecting my workspace; I spend a ton of time at a computer, and so I’m extremely invested in how my tools perform. A window manager is a pretty important tool, and my window manager of choice is xmonad. Over time, I feel my xmonad configuration and setup has evolved into something really nice.
Why would someone use a tiling window manager like xmonad? The short answer is usually efficiency. People spend a lot of time organizing windows, and using their mouse. If you could instead never take your fingers off the keyboard (for the most part,) your efficiency would go up. This won’t be true at first as people learn key bindings, but after awhile you become drastically faster at the mundane parts of computing, like switching between windows, or organizing them in different ways. This approach is definitely more minimal, but I’d recommend this if you spend your day in vim, emacs, terminals, or other text-heavy applications. Even Gmail has key bindings so that I don’t have to touch my mouse.
Other perks of using xmonad include things like xmobar, which is surprisingly useful, as it gives tons of information about the state of xmonad, your system, and your local weather, without being at all intrusive. To start programs, you’ll want to use something like dmenu, which auto-completes command names as you type.
If you’ve never used xmonad, then this post is intended to help you get going. Otherwise if you’re an avid user, then this post will give you a consistent, good looking setup that you’ll hopefully find usable and better than the xmonad defaults.
Here’s a screenshot from my workstation:
I’ve heard a few comments on how nice everything looks, so I took some time to release the necessary configuration files and scripts in a github project. Why is this nice? Because the color scheme is consistent, the layouts are scalable, and the key combinations are standard. If you use the IR_Black theme for vim or your terminal, you’ll notice even more consistency throughout.
I’ll run through really quickly how to set this up.
This set of configuration and scripts has the following requirements, but should work with other versions of these requirements (minor modifications required for older versions of xmonad or xmobar.)
- xmonad 0.9.1 or 0.9.2
- xmonad-contrib 0.9.1 or 0.9.2
- xmobar 0.11.1 or 0.13
- trayer 1.0
- dmenu 4.0
- yeganesh 2.2
- scrot 0.8
To install these on an Arch Linux machine, run:
:::bash sudo pacman -S xmonad xmonad-contrib xmobar trayer dmenu scrot \ cabal-install cabal update cabal install yeganesh
Next, clone the github repository:
:::bash cd mv .xmonad .xmonad.orig git clone firstname.lastname@example.org:vicfryzel/xmonad-config.git .xmonad echo "export PATH=\$PATH:~/.cabal/bin:~/.xmonad/bin" >> ~/.bashrc source ~/.bashrc
Now all you have to do is start xmonad. The way you do this will vary, but if you’re using something like SLiM, then just use the .xinitrc provided with the configuration you already downloaded:
:::bash mv ~/.xinitrc ~/.xinitrc.orig ln -s ~/.xmonad/bin/xinitrc ~/.xinitrc
Adjust ~/.xinitrc as needed (e.g. if you don’t use Google Chrome or xscreensaver.)
That’s it! You should now have a desktop looking like the screenshot above.
If you’re new to xmonad, the key combinations can be daunting, so here are some of them to get you started:
- Alt+p: Run dmenu. After it’s running, start typing a command and hit enter
- Alt+Shift+Enter: Launch a terminal window
- Alt+1, Alt+2, …, Alt+9: Switch to workspace N
- Alt+w: Switch to the left screen
- Alt+e: Switch to the right screen
- Alt+j or Alt+Tab: Switch to the next window
- Alt+k: Switch to the previous window
- Alt+Space: Cycle through layouts for the current screen’s windows
- Alt+Enter: Make the currently active window a master window
- Alt+,: Increase the number of windows in the master area
- Alt+.: Decrease the number of windows in the master area
- Alt+m: Switch to the master window
- Alt+Shift+j: Move the currently active window forward in the layout
- Alt+Shift+k: Move the currently active window backward in the layout
- Alt+l: (That’s an L.) Make the master area window bigger
- Alt+h: Make the master window area smaller
- Alt+Ctrl+l: (That’s an L.) Lock the screen with xscreensaver
- Alt+Left Mouse Button+Drag: Untile the selected window and move it
- Alt+t: Move the currently active window back into tiling
- Alt+Right Mouse Button+Drag: Tile and resize the selected window
- Alt+q: Reload the xmonad configuration
- Alt+Shift+q: Exit xmonad
People are sometimes intimidated by all of these shortcuts and the new style of interface. Remember that the currently active window will be surrounded by a red border. Also, there are a series of layouts you can use. Alt+Space makes cycling between them easy. I recommend you write the key combinations down or print them out, that way if you forget you won’t be stuck. For things like watching a movie, just fire up mplayer and hit ‘f’. Fullscreen mode works just fine. Otherwise if you don’t want to fullscreen and you don’t want to tile the video, just Alt+Left Click+Drag, as described above.
Once you are all setup you should:
- Modify ~/.xmonad/xmobar.hs to show the correct weather for your location
- Modify ~/.xmonad/xmonad.hs and ~/.xinitrc as needed if you don’t use xscreensaver, Google Chrome, etc.
For further reading, see:
Let me know if you have any questions, I hope this has made xmonad better for you!
Update (Jun 28): Mats Rauhala / MasseR has been kind enough to improve the bin/dmenu script to not crash some systems. +1 to him I’ve merged his changes into the github repo mentioned in this post.
Update (Nov 12): An anonymous user pointed out the github clone URL I gave was wrong. They were right, I’ve fixed it.
Update (Sep 11 2011): Updated installation instructions for latest version of configuration in repository. Also :%s/Xmonad/xmonad/g.