How to transform Archbang into Arch Linux with Xmonad

Archbang is a linux distro based on Arch Linux. Archbang helps users to enjoy a full experience of Arch Linux without the cumbersome installing process. The default window manager of Archbang is Openbox, it is really light weight, highly customizable and easy to use. However it is very easy to replace Openbox in Archbang with other window managers. Today I will show you how to replace Openbox with Xmonad in Archbang.

transform archbang into arch linux with Xmonad


To install Xmonad in Archbang, the command will be:
 sudo pacman -S xmonad xmonad-contrib  

Next, you need to edit the start up file (~/.xinitrc) to start Xmonad after you login as a normal user. Here are some things you need to add into this file:

First, Xmonad does not set an X cursor by default, therefore you will see a "cross" cursor instead of a normal cursor, which can be confusing for some people. To set usual cursor, add the following line in to ~/.xinitrc:
 xsetroot -cursor_name left_ptr  
Next, since Xmonad set the US keyboard as default, you need to add the following line into ~/.xinitrc if you are using a non-US keyboard. For example, suppose you're using a French keyboard:
 setxkbmap -layout fr  

The next line you need in ~/.xinitrc is to launch Xmonad. In Archbang, this line is originally like this:
 exec ck-launch-session dbus-launch openbox-session  

You just need to replace the "openbox-session" with "xmonad" and everything is done. A working ~/.xinitrc will look like that:
  xsetroot -cursor_name left_ptr   
  exec ck-launch-session dbus-launch xmonad   

That's all you need to do to replace Openbox with Xmonad in Archbang. If you want to know more about how to configure and customize xmonad, please check my xmonad tutorial

Besides, when you start Xmonad in Archbang, you wont see anything but the background of the SLim login manager. To restore the wallpaper, since nitrogen is used in Archbang, consider adding the following line into the start up file ~/.xinitrc:
 nitrogen --restore &  

If you like my xmonad tutorial and want to use xmobar and trayer, you need to add the command to start trayer in ~/.xinitrc. Also, to get network manager showing up with trayer, what you need to add into ~/.xinitrc will be like this:
 trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 6 --transparent true --alpha 0 --tint 0x000000 --height 16 &  
 nm-applet &  

Overall, your ~/.xinitrc should be like this to replace Openbox xith Xmonad in Archbang:
 #!/bin/bash  
 nitrogen --restore & 
 trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 6 --transparent true --alpha 0 --tint 0x000000 --height 16 &  
 nm-applet &  
 xsetroot -cursor_name left_ptr   
 exec ck-launch-session dbus-launch xmonad  

Note: I dont tell you to totally remove Openbox in Archbang here. If you follow this guide, you will use xmonad when you login as a normal user. If you log in as root in Archbang, the window manager will still be Openbox. To go back to Openbox, just restore the start up file ~/.xinitrc to the original one.
linux tips and tricks