Openbox Desktop example.
Click for larger image.

Tutorial Xinitrc Desktop Manager Control for Linux

by Lewis Loflin

(Above) Openbox Desktop with Idesk and WBAR quick launch icons, Conky system monitor, and Tint2 taskbar.

The background is set by FEH. The Audio and desktop Python select boxes are separate.

Update September 2020. Some versions of Raspbian for the Raspberry Pi doesn't have a file .xinitrc so you have to create it.

The purpose is to introduce one to .xinitrc to configure desktop environments. I'll present several examples.

The examples work on regular PCs and Raspberry Pi.

This was originally oriented towards Raspberry Pi a popular single-boards computer. See Raspberry Pi Openbox Desktop 2020

It uses an ARM version of Debian Linux. What works on a Raspberry Pi desktop will normally work on standard PC with Debian Linux.

I have a number of older personal computers I use for electronics control and practice programming. I want a fast, functional desktop I control and configure. I also want to use the same setup across multiple type machines.

Thus I use "lite" Linux distributions. On this website I'll looking at Openbox, Fluxbox, FLWM, JWM, and PEK. I can run all on same machine (not at the same time) by using a single file to configure.

A file proceeded by a "." is hidden unless the file manager is set to show hidden files.

This hidden file .xinitrc is placed in one's home folder. This operates from the command line login. It is ignored when using a graphical login manager.

It constructs your desktop environment, what window manager to use, and what pin boards, panels, icon setters, wallpaper, etc. will appear.

Type startx and the system will search for a file the .xinitrc in your home folder.

This assumes the correct software is already installed and configured. For this I'll assume Raspberry Pi with its version of Debian 10 or Buster.

Some Basics

LXDE which comes installed on Raspberry Pi. It can be installed from a Debian CD to a PC. LXDE means "Lightweight X11 Desktop Environment". A "desktop environment" includes underlying X11 software that operates the video hardware. A window manager creates "windows" and is "on top" of the X11 then everything else is mixed in such as pin boards, panels, etc.

LXDE, XFCE, KDE, etc. are desktop environments. So LXDE consists of the LXpanel-taskbar with menu, clock, and program icons. The background-pin board is the PCmanfm file manager, and all is built on top of the Openbox window manager. Or should I say a version of it.

I'll install or start with LXDE then add whatever else I want.

sudo apt-get update

If LXDE is installed then lxpanel, volti, clipit, pcmanfm for pinboard, and a variation of openbox are already in the system. At least on a Raspberry Pi.

So I'll install alternate window managers including full openbox:

pi@raspberrypi:~ $ sudo apt-get install openbox menu obmenu jwm pekwm fluxbox flwm

All of these window managers are just that. Openbox, pekwm, and flwm are barren black screens with a very limited menu.

JWM and fluxbox also have limited menus but come with their taskbars-panels.

Simply install the ones you want.

Non-LXDE openbox differs somewhat from regular openbox. Obmenu and menu work with all versions.

Next we need some taskbars-panels. Let's look at a few.


This is a close up view of the lxpanel. Includes popup menu (under the raspberry), clock, tray volume control (volti), parcellite clipboard manager, and blue tooth and wireless control icons. This is from Raspberry Pi LXDE. I added parcellite.

The three quick-launch icons on the left for web browser, file manager, and terminal.

Fbpanel example.

This is FBpanel that includes popup menu under the Debian symbol, three quick-launch icons, assorted system monitors, volti, parcellite, clock.

pi@raspberrypi:~ $ sudo apt-get install fbpanel volti parcellite

Xfce4-panel example.

This is the XfCE4-panel from the XFCE Desktop. Has popup menu, clock, parcellite, and volti. It is easy to add quick-launch icons.

pi@raspberrypi:~ $ sudo apt-get install xfce4-panel volti parcellite

Tint2 panel example.

Tint2 above has no popup menu. I has three quick-launch icons, parcellite, volti, clock.

pi@raspberrypi:~ $ sudo apt-get install tint2 volti parcellite

The first three their menus work as is for the most part.

Pcmanfm file manager comes with Raspberry Pi LXDE desktop. It also doubles as desktop manager with LXDE. It also comes with LXpanel that can be used with another window manager such as Openbox.

WBAR quick launch icons

Above is WBAR. It can be programmed for top, bottom, left, right. See Setting up WBAR.

FEH is used to set the desktop wallpaper. This is seen when no pin board is used. See Using FEH.

Rox-Filer is a drop-drag file manager. It also creates "strips" for quick-launch icons or a pinboard for quick-launch icons.

Idesk is a icon setter for the Linux desktop. Don't use with rox-filer or pcmanfm pinboards.

pi@raspberrypi:~ $ sudo apt-get install rox-filer conky feh idesk wbar

Example 1

This is what .xinitrc would be for the desktop at the top of the page.

Note that except for the window manager command at the end everything must be followed by a "&". This tells Linux these programs operate in the background.

# ~/.xinitrc

sh ~/.fehbg & 

exec tint2 &
parcellite &
(sleep 4s && conky) &
volti &

# wbar must be installed and configured
(sleep 2s && wbar) &

# don't use with rox pinboard
(sleep 2s && idesk) &

exec openbox-session 

Fuxbox Desktop example.
Click for larger image.

Example 2

Above is an example of the Fluxbox desktop. I added FEH wallpaper, conky system monitor, Rox-Filer strip.

Fluxbox has its own built-in taskbar.

# ~/.xinitrc
# Executed by startx (run your window manager from here)

sh ~/.fehbg & 
#This is a panel strip for the top or bottom
rox --top=myp2 &
parcellite &
(sleep 4s && conky) &
volti &

#when you start fluxbox in your ~/.xinitrc, use 'startfluxbox' instead of fluxbox.
#exec startfluxbox
exec fluxbox

PEKWM Desktop
Click for a larger image.

Example 3

Above is the PEKwm desktop with FBpanel and the Rox-Filer pinboard.

# ~/.xinitrc
# Executed by startx (run your window manager from here)

rox --pinboard=pblewis &
fbpanel &
parcellite &
volti &
exec pekwm

LXDE Desktop example.
Click for larger image.

Example 4

Finally above is the Openbox-LXDE desktop. It has the Rox-Filer strip, Conky system monitor, and Lxpanel. I'll use lxde version of openbox.

There are three variations of openboxlxde that produce differing looks on the LXpanel. The panel call volti and the system clipit.

This was configured for a Raspberry Pi Model 4.

# ~/.xinitrc
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  unset f

sh ~/.fehbg & 

#This is a panel strip for the top or bottom or top 
rox --top=myp2 &

lxpanel --profile LXDE-pi &
(sleep 4s && conky) &
parcellite &

# if using this comment out volti, clipit

#alternate lxpanel no clipit
#openbox desktop

#/usr/bin/startlxde banner.

Web site Copyright Lewis Loflin, All rights reserved.
If using this material on another site, please provide a link back to my site.