Skip to Content

Custom Arch Linux setup with Openbox

Posted on 8 mins read

After my summer vacation started, I bought a new laptop and the first thing I did was to install Arch Linux on it. After a standard arch installation procedure, I started putting together my own desktop environment starting with ArchLinux and Openbox and then piecing all pieces together to build a proper desktop environment. Building a desktop this way really follows the Unix Methodology; have softwares that each do one thing well, and when you put them together you get something amazing.

When I first installed Arch, I had several choices. I tried xfce and gnome as my desktop environments. While both of them have their own pros and cons, I ended up liking none. The sole reason was the dependencies, these two softwares bring with them. My sole intention of installing Arch was to have something, which I control, not like Ubuntu, where you are forced to use the preinstalled softwares and when you try to uninstall something, you fear of breaking some other program.

So I end up going the route of building something up from scratch using Openbox as a base. At this point I have a fast, lightweight desktop that is extremely stable and is truly my desktop as I have built it from the ground up choosing every application.


Window Manager

After the installation of Arch, the first thing I did was to install Openbox, a Tiling Window Manager. You may also try other window managers like awesome, i3 and fluxbox etc. but I chose Openbox because it is used everywhere and thus there is a plethora of information out there about customizing it.

For our window manager to show up, it needs to be added either in a login manager or user’s ~/.xinitrx file. There is a default version of this file which contain some code which we may want to retain, so rather than making this file from scratch, copy the default version of file to user’s home directory.

cp /etc/X11/xinit/xinitrc ~/.xinitrc

Now add the command exec Openbox-session to the end of the file. Remember that the lines following this command will be ignored by the system. An openbox session should be able to be started by entering the command startx.

An openbox session can be started automatically upon login using shell’s startup script. Add following to the shell’s startup script, ~/.bash_profile for bash and ~/.zprofile for zsh.

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

Configuring Openbox

Setting up openbox is quite simple. Four files make the basis of openbox configuration. They are rc.xml, autostart, menu.xml and environment. These files controls everything about the window manager.

  • rc.xml: Determine the behavior and settings of overall openbox session
  • autostart: Contains a list of applications to be launched with window manager
  • menu.xml: It makes the right click context menu of Desktop
  • environment: Can be used to export and set relevant environmental variables

To configure openbox, it is necessary to create a local openbox profile in user’s home directory. A global configuration can be found in /etc/xdg/openbox which is well documented and copying the global configuration to the user’s directory will give a good starting point to customizing from.

cp -R /etc/xdg/openbox ~/.config/

These files can be edited by hand, although some graphical tools are also available, use of these may be desired.


Themes and Appearance

obconf and lxappearance-obconf can be used to configure appearance and theme of openbox session. There are quite a few themes available in openbox-themes package. My personal favorite is Numix-themes and Numix-icon-theme-git (AUR).

In order to see changes after editing a configuration file, open box needs to be refreshed. This can be done with the reconfigure command.

openbox --reconfigure

The type and behavior of Openbox menus, accessible by right-clicking the background, can be changed using ~/.config/openbox/menu.xml file. Openbox provides two kinds of menus, Static, and Dynamic menus (Piped and Generators)

Static menus are hard code in XML and is stored in menu.xml file. Whenever you install a new application, you will have to manually update the XML file to update the menu. This is a viable solution if the applications are bot installed on a day to day basis.

Pipe menus are the sections of openbox menu which openbox creates on the fly, by running a generic script and using its plain text output as menu entries. This scheme can used in different ways like adding a mail checker in the menu, or adding a weather forecast menu. You can check openbox pipe menu page for more information.

Generators are the most convenient type of menus. These can be found in most desktop environments where applications show up in the menu automatically. If applications are being installed on a regular basis, then this will probably be the preferred choice.

Static Menus

The process of making these menus can be automated by static menu generator like obmenu. It will generate static menus from installed applications by looking into certain directories. Others available tools are menumaker, obmenu and xdg-menu.

Dynamic Menus

Dynamic menus give the same kind of functionality most people are used to. So it was my preferred choice. They can be used to generate full, complex menus on the fly. One of the most popular application for generating dynamic menus is obmenu-generator (AUR). Though it is not officially connected to openbox but it is widely used.

In order to have obmenu-generator (AUR) make a menu on demand, the menu.xml file should contain the following code as the only entry.

<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
    <menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator"></menu>
</openbox_menu>

Panels and Taskbars

You can get any panel like xfce4-panel or the simple and customizable tint2. I chose tint2 because it very closely follows the openbox spirit of having easy customization with plain configuration files. tint2 package also containg a graphical tool tint2conf for customizing panel and you can obviously go right to the tint2 configuration file and edit it there. This also means it is easy to pick up your configuration file and move it to another computer, or restore an old configuration since it is as simple as pasting a text document in the right place. tint2 can also have sections for each individual desktop and has various small widget like programs that can be used with it such as a calendar, gsimplecal, a volume application, volumeicon, a battery indicator, cbatticon, a network indicator like wicd which also have a system tray icon and a mini task tray. To start tint2 with openbox, you need to add tint2 & to the autostart file.


File Manager

Some file managers deeply integrate into desktop environments and when installed with openbox, they end up pulling multiple dependencies which is certainly not desired. Our aim behind building openbox setup was to have minimum dependencies so that we can get lightweight desktop. However, there are several file managers available which fit into openbox very well. In my choice, pcmanfm is the best choice here. pcmanfm is a lightweight and fast file manager with network and thrash support. pcmanfm can also manage desktop icons and wallpaper setting, although if you plan to use conky in your system, then you may not want pcmanfm to manage desktop for you. The reason is that pcmanfm treats desktop as a window, so when you switch to desktop, the conky hides behind the desktop window. To get the icons and wallpaper, you can use other standalone tools such as idesk and feh or nitrogen. To start pcmanfm is desktop mode, add the following to the autostart file

pcmanfm --desktop &

and to stop it for managing desktop

pcmanfm --desktop-off &

In order to use many of the functions that are in file managers it is necessary to have a a few additional programs. gvfs gives you the ability to mount volumes and have trash control. It is not mandatory to have, but it allows on demand mounting to be done completely within the file manager, as opposed to having to drop down to the command line. A volume manager such as udisks2 will also be wanted, and for auto-mounting removable disks, udiskie works well with openbox. udiskie can be added to openbox’s autostart file like any other application.


Composition

Openbox does not provide native support for composition, although having a compositor may prevent screen flickering and other distorting with applications like oblogout. There are some options which work great with openbox. The one which I am using and quite happy with, is compton. It can be used with or without any initial configuration, although there are lot of different configuration options if you decide to customize the setup. To start compton in background with shadows, use this in autostart file.

compton -b -c &
.


Wrapping up

While setting up my desktop using openbox ended up being much more work than I could have with normal desktop environments. But now I have much more stable desktop, about which I know, what is running in my system, and that my system is not cluttered with any software that I never use.

While it might not be for everybody having to configure every little bit of the desktop, I truly feel I have ended up with a great user experience, and a system that is customized exactly to fit my needs.


References

comments powered by Disqus