tonylog: Install and configure xorg and dwm on arch linux

This is a tutorial on how to install and configure dwm on arch linux. Given that dwm runs on X, as most window managers do, there is a guide on how to install Xorg on arch as well. Both, will guide you through step by step in an hopefully easy way.

Installing all packages myself on arch linux I thought i might as well try something new and adventurous. Looking around the web I found a few enthustiac programmers that use tiled window managers. Researching i found that the one for me is dwm.

Main characteristics of dwm are size, it weighs less than 10 MB dependencies included, and possibility of customisation, given that it is written in C and that its code its very readable. Going to the official website of dwm I found this description:

dwm is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. Either layout can be applied dynamically, optimising the environment for the application in use and the task performed.

So far it sounds very good! Light, fast, few dependencies. Regarding the customisation bit……every time a change is made you need to recompile and reinstall. It may seem a bit crazy, however, thinking about it:

  • There is no risk to introduce obscure bugs with config files
  • If you make a mistake nothing will freeze, it will not compile giving you the chance to fix
  • It is faster

Ok let me take dwm for a spin.

When installing arch linux, no Xorg is shipped with it so before installing dwm, Xorg has to be installed and configured. Fairly straight forward….

pacman -Sy xorg

Once xorg is downloaded and installed we need to configure it. There are many tools around but the favourite oneĀ  in the arch community is hwd

pacman -S hwd

hwd is a program that automates the production of the xorg.conf file. This configuration file is the most important as it sets the drivers and paths for:

  • Keyboard
  • Mouse
  • Video Card
  • Monitor
  • Fonts

Once hwd is installed we need to create the xorg.conf file with:

hwd -xa

This command will create two xorg.conf files:

  • Default vesa driver xorg
  • Video card specific xorg (which won’t work if you don’t have your card drivers installed)

The moment of truth

To verify the xorg files we need to run X with a different xorg.conf, to achieve this we need to use the command:

X -config name_of_the_conf_file

So let’s do it!

cd /etc/X11

X -config xorg.conf.vesa

The TWM window manager should start up. To run your card’s specific conf use its xorg file, xorg.conf.ati, xorg.conf.nvidia or xorg.conf.trident (in my case :) ). Once, you are certain of having a working conf file rename it to xorg.conf (eg. mv xorg.conf.vesa xorg.conf) so that when you startx it is automatically loaded.

Xorg is now configured. Let’s install dwm

pacman -S dwm

When done we need to set dwm to startup when we invoke startx instead of TWM, to achieve this we need to edit the file xinitrc so from the home directory:

cd /etc/X11/xinit

vi xinitrc

Here we need to find the line that says:

#Start some nice programs
twm&
xclock …
xterm …
xterm …
exec xterm…

Comment the above lines and add:

exec dwm

Now the command startx will start dwm as your window manager.

Resources: