My quest for a perfect setup


How I switched from OS X to Linux. I’ve been working on OS X for over a year. Everything was fine, better for working than Windows and most of all based on Unix, which is a huge plus when doing programming. Most of the time, I was working with in a shell, for which iTerm2 worked pretty well. It is way more efficient to work with the command line all the time, which is why i switched to mutt for email, vim for text editing, irssi and later weechat for irc.

But working on the command line has some disadavantages on OS X. Switching between the windows is not as simple as it should be, either doing it by cmd+tab, or with the mouse or with terminal tabs, or with a terminal multiplexer like tmux or screen. Neither of those possibilities is completely satisfactory for various reasons. With cmd+tab, you always need to touch tab for a different number of times, and you always have to remember where you are. With the mouse you have to take your hands of the keyboard each time, which is annoying when the next thing you do is typing something again. Terminal tabs work pretty well, as they can be accessed with keyboard shortcuts, but you can’t to switch to anything other than terminal tabs using that method (I do like to use a graphical web browser sometimes). The same holds for terminal multiplexers, which are great for working inside a terminal, but not for anyting else.

The OS X command line also seems somewhat crippled, as it follows posix standards, but some gnu tools are not available. This became particularly important when I started my Google Summer of Code project with git this year. It was not possible to execute the performance tests for git with the native OS X command line tools, because of the crippled time command.

Another reason was that OS X seems to become more and more a closed operating system, with their app store, which seems to make it harder to provide normal apps to the users. The iCloud and its deep integration into the operating system didn’t make me feel much better about that.

Using a multi-monitor setup with OSX is another complete failure. While they allow you to have multiple desktops, with different programs, it’s impossible to show two of those virtual desktops on two different monitors. It is always only possible to use one desktop on both monitors. Even worse, when using one app in their new full-screen mode, one monitor will be filled with the app, while the other monitor will be filled with some gray background, because apparently that looks good. I don’t mind something looking good, but if half the screen space gets unusable because of that, it’s bullshit. I hoped that it may get fixed in 10.8 Mountain Lion, but as nothing changed.

The “perfect operating system”, as some may call it, because of its stability also crashed fairly often with kernel panics. I’m not sure if it was because of the way I was using it, or because of the way it was programmed, or maybe even because of some kind of hardware failure (which I can nearly rule out now, because linux seems to run stable), but it was highly annoying, especially if it’s happening in the middle of some work.

Xmonad

The concept of the Xmonad Window Manager seemed very appealing at this time. I first saw its power when I was working on my Summer of Code project with my mentor Thomas Rast, who was using that window manager. The tiling window manager allows you to have more desktops, with multiple windows on it, which all can be accessed through keyboard shortcuts. My main layout is a tiled layout with one resizable main window on the left side, and a number of smaller windows stacked on the right side. I only have configured one other option, which is the tabbed layout, which allows me to have each of the windows on one desktop in full-screen mode and switch between them like tabs. This mode is usually only used when watching some video in a browser, otherwise I tend to just open a new desktop for a full-screen window.

My setup is usually a web browser on the first desktop, irc and email on the second one, an editor on the third one, and whatever I need on the other six desktops, depending on what I’m currently working on. Usually a maximum number of five to six desktops are used, more are only needed in special cases.

I’m using Xmonad without any Desktop environment, which means that many things don’t work automatically or have to be configured to work automatically, like auto mounting of usb storage, going to sleep when closing the desktop lid, etc. I didn’t get around to configure them yet, as I can work just fine without them, but for a perfect setup they would have to be configured. If you don’t feel like you can’t live without those things, and don’t want to configure it by yourselve, you can just use Xmonad to replace the window manager in your desktop environment, such as metacity in gnome. It’s funnier and more geeky without that though.

Xmonad is written in Haskell and configured with a configuration file in haskell. Don’t be scared though, a decent configuration can be created without any knowledge of Haskell, and many sample configurations are available online for free. Just get whatever you want from there. You can also find my configuration on GitHub, in case you want to try it out.

Configurations for Xmonad can be loaded on the fly, without restarting Xmonad or even X. You can just edit the configuration and press Alt+Q in the default configuration to reload and test it. If there is an error in the configuration file, Xmonad will show it, and continue to work with the old configuration.

Xmobar

Xmobar is a text based status bar, that was initially designed for Xmonad, but can also be used with other window managers. I’ve set up the Xmobar to show me the different desktops, the way the Windows are displayed (Tiled or Tabbed), information about the CPU, memory, the internet connection, audio volume, emails, battery information and the current time and date. This is all static information, that is automatically updated by the Xmobar. I’ve placed a few scripts in my .bin folder, that get the information and are then executed by the Xmobar to display it.

Trayer

An important small app that makes using Xmonad a lot easier is trayer. It is a system tray, that can display gnome applets, for example the network manager, or the gnome-sound applet, which provide a graphical interface for things that otherwise would have to be accessed via the command line.

Conclusion

It feels like using Linux and especially Xmonad has improved my productivity, and overall joy to be productive when I’m working on my pc. I don’t miss any of the programs that I’ve used on OS X. An initial concern was the fonts, which are quite different coming from iTerm, but I’m currently using the Source Code Pro font, which is a free font from Adobe, which works out nicely.

I’ve messed up the system a couple of times, by playing around with it, once when trying to install Windows, and once when installing the proprietary nVidia driver, but could always recover with a few hours of extra work.

The system still has a few rough edges and is far from perfect, but part of that may be my lazyness to perfect it, which may happen in the coming months or years. There pretty much is nothing you can’t configure or can’t do with this setup.