LXDE Raspberry Pi Desktop hacked version.

Raspberry Pi Openbox Desktop 2020 - Hacking LXDE

by Lewis Loflin

For the full screenshot: lxde1.png.

This will be split into two broad sections. One concentrates on assorted desktops, programming, and setup. This will include heavy use of bash scripts and python.

The other parts will concentrate on hardware interfacing and electronics using C and python. I'm using Debian distributions only and these programs apply to any Debian distribution even on a normal PC.

Many of these ideas are ported from Damn Small Linux and Puppy Linux. I use them on Tinycore Linux as well on a 20-year-old Compaq computer with a Pentium 3.

The original Raspberry Pi computer came out February 29, 2012. The Pi 1 was a sensation. Today we have the Raspberry Pi Model 4 with up to 8G RAM. Mine has 4G.

It is a massive improvement in computing power and features. It is still priced at $35. 14 to 15 million of all types have been sold. Wikipedia has an excellent history on the Raspberry Pi.

Here I'll address the Pi 2, 3, and 4. The Pi 2 lacks wireless and Bluetooth and is slow on more recent Raspbian distributions. It's annoying the evolution in Debian distributions created all sorts of havoc.

The original operating systems from 2012-13 used Wheezy and Squeeze both have dead program repositories. Debian 7 Wheezy support ended May 2018. Debian 8 Jessie end May 2020. Debian 9 is good until 2022. The most recent release is Debian 10 Buster.

Support for any Debian distribution is 3-5 years. Changes often make earlier programs non-functional. Also the newer distributions in my view are becoming more bloated and less flexible.

This will evolve around the Openbox desktop.

I will make heavy use of bash scripts and Pyhon3-tk for graphics. The goal is to learn Linux desktops for speed and function. I will not deal with bloated or inflexible KDE or Gnome.

Openbox desktop

Hacking LXDE

Open a file manager as root from a terminal:

pi@raspberry: sudo pcmanfm

Go to /etc/xdg/lxsession/LXDE-pi/autostart and open the file with a text editor. We have the following:


@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash

As an alternative copy the entire folder lxsession to your home folder /home/pi/.config/ and the system will operate from there.

The above turns on lxpanel (bar at top of desktop), pcmanfm is the desktop pinboard, plus the screen saver. Change as follows:


# don't use &
@lxpanel --profile LXDE-pi
#@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@lxdewp.sh

I have commented out lxpanel and added a bash file lxdewp.sh. Put this in bin in your home folder. In text editor and create the following:


#!/bin/bash
# /home/pi/bin/lxdewp.sh
#These programs must be installed!
# conky, wbar, and rox panel or strip must be configured.
# all must installed

#wallpaper setter  feh
sh ~/.fehbg & 

# clipboard manager clipit is already installed in 2021
#exec clipit &
parcellite &

# system monitor conky must be installed
(sleep 4s && conky) &

# can be set left, right, top, or bottom.
# ex: don't set wbar and rox-strip to the same place
# position must be set in ~/.wbar 
# must be installed
(sleep 3s && wbar) &

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

# rox pinboard don't run with idesk
# rox --pinboard=pbmine &

# rox strip set for bottom, top, left, or right.
# this assumes lxpanel is on top.
rox --bottom=myp2 &

# exec tint2 &
# exec xfce4-panel &
# lxpanel --profile LXDE-pi &

exit

Set this file to executable:

chmod +x lxdewp.sh

Reboot system and get the following at the top assuming the other parts have been configured.

Openbox desktop

While the newer versions are more powerful they still suffer some pitfalls due to keeping the price down.

There is no hard drive instead using a Micro SD card to store data and the operating system. I'm very wary of those due to limited read-write cycles. Get a higher quality card. I'll assume the reader can program their own or buy it.

For backup of programs I use a 64-Gig Lexar USB 3 thumb drive. I'll go into using that and even how to connect an external hard drive for data backup.

It lacks a real time clock that we will see how to install. If connected to the internet a hardware clock isn't needed, but I want one.

For this I use the official Raspbian with desktop, not the other bloated version with Libreoffice, kiddie software, etc. It come with a basic LXDE desktop Linux system.

This is a vast improvement over the original versions. On my Raspberry Pi 2 it found my D-Link USB wireless adaptor with no problem. It included WiringPi to access the GPIO pins already installed. I2C, one-wire, etc. can be activated from a menu.

The goal is to create fully functional desktop style Linux PC. Raspbian is based on Debian. I will be able to use the parts of LXDE in the new system or revert right back to the original.

Underneath LXDE is Openbox. I'll add useful additions and hake the system configurable with a single mouse click. The idea is to eliminate slow software for a faster, more flexible system.

The idea is to learn Linux, bash, python, C, and C++. How to configure different systems and programming the hardware GPIO pins. I'll be making heavy use of bash script and python popup boxes.

Raspberry Pi 3

Initial Setup

The first thing to do is take total control of the system. In the menu go down to preferences, Raspberry Pi Configuration, and open the above box. Check "To CLI" to boot to the command line. One will be logged in as Pi simply type "startx" and system will operate as before.

While here reset your password and under interfaces check off i2c, one wire, etc. or whatever you plan to use. Close out the box.

As it is when "startx" is entered it does the same as before. One must add a file .xinitrc into your home directory Pi. Startx will use this file to configure the system. If missing it defaults back to the original LXDE.

Caution: you can create system chaos if .xinitrc isn't set up properly! I'll explain this more fully in a moment. First we must download and install some programs.

Open a terminal window and do the following:

pi@raspberrypi:~ $ sudo apt-get update

Wait for it to finish and download the following: rox-filer, feh, apt-file, openbox, tint2, nano, obmenu, scrot, clipit, aterm, locate, mpg123, menu, i2c-tools, python-smbus. Download more than one at a time don't use commas! For example:

pi@raspberrypi:~ $ sudo apt-get install rox-filer feh openbox tint2 etc.

The xfce4-panel is optional. It does what the native lxpanel does but list programs missing from lxpanel.

This very simple version of .xinitrc will get you started with Raspberry Pi Openbox. Then we can build from there. The LXpanel works as before.

Copy the following to a file in a text editor as ".xinitrc" and save in your home directory.


#!/bin/sh
# ~/.xinitrc
# Executed by startx
exec lxpanel &
exec openbox 

You get you original panel at the top and Openbox desktop. You will not get the Rox pinboard. In the following pages we will grow to a full system.