Saturday, November 30, 2024

Minimalist Linux

Honestly, I am not a fan of the minimalist Linux movement. Today's machines are more than capable of handling what we throw at them and RAM is cheap. There is no reason not to use Gnome or KDE and even if you prefer a more legacy look, MATE and Cinnamon work just as well. The problem with minimalist desktops is you sacrifice ease of use and functionality. I don't care what anyone says ctrl-t is not easier than clicking on a button.

Having said that, there is some use for such a setup, for instance if you have a low end machine with limited RAM and no upgrade paths. In this case a GUI that eats less than 512 MB of RAM is nice. I have a Lenovo ideapad-1 with a Celeron G4020 and 4 GB of RAM, I like it because it is light and easy to carry around a busy airport. Gnome or KDE would bring this system to its knees and even MATE is a bit much for it.

In a case like this, I would forgo a Desktop Environment (DE) altogether and just use a Windows Manager (WM), in this case Openbox. A WM provides the basics, windows and decorations nothing more, a DE goes a step further and add the bells and whistles that make things easier to use and flashier.

The first step is to install Debian 12, when you get to the part where it asks what Desktop you want, uncheck everything except the bottom two options. Once that is done, reboot and log in as root, update the system and add the user you created to the sudo group. Then reboot again and log in under you user account.

Next comes installing what you need

sudo apt install xorg xbacklight xbindkeys xvkbd xinit xinput xserver-xorg-input-all xterm openbox obconf dunst dbus-x11 feh hsetroot i3lock libnotify-bin libxcb-xinerama0 lxappearance lximage-qt menu picom rofi scrot tint2 volumeicon-alsa xfce4-power-manager alsa-utils fonts-dejavu fonts-firacode fonts-font-awesome fonts-liberation2 fonts-ubuntu fonts-jetbrains-mono gtk2-engines-murrine gtk2-engines-pixbuf network-manager network-manager-gnome papirus-icon-theme pavucontrol pipewire-audio qt5-style-plugins rox-filer conky

Here we are installing our applications, I am avoiding heavy duty applications like LibreOffice and GIMP in favor of applications like Abiword and Inkscape, which eat less memory. Adjust to taste.

sudo apt install firefox-esr audacious thunderbird vlc emacs abiword gnumeric atril pluma mate-calc tilix inkscape
These next commands setup our WM in a basic configuration

mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/* ~/.config/openbox/
systemctl --user --now enable wireplumber.service
Then we are going to setup the utilities needed for the basic functioning of the desktop. Type the following;

nano ~/.config/openbox/autostart
And add these lines;

hsetroot -solid "#000000"
xfce4-power-manager &
dunst -config ~/.config/dunst/dunstrc &
tint2 &
(sleep 5; volumeicon) &
nm-applet &
The hsetroot command sets the background color, #000000 is hexadecimal for black, for a nice blue, use #2e86c1, if you want to choose your own color, this site will help, https://htmlcolorcodes.com/ . You can set a picture as your background using a program call feh, but I am not covering that here.

Next we need to edit the .xinitrc file so when xorg starts, it knows what WM we are using. Type this command;

nano .xinitrc

and add these lines;

#!/bin/bash
exec openbox-session
Now, type startx and Openbox will start. You will see a blank screen, with a bar at the bottom. Right click on the background and choose terminal off the menu. In the terminal type in;

rofi-theme-selector

Rofi is the tool we will use to find and run programs. In its default state a window pops up in the middle of your screen, I prefer a bar at the top. Off the menu of choices, choose the demnu theme, to set the theme. Then we will want to configure rofi, so it shows icons with the programs. Type in the terminal;

nano .config/rofi/config.rasi

and add these lines to the file;

configuration{
display-drun: "Applications:";
display-window: "Windows:";
font: "JetBrainsMono Nerd Font Medium 10";
modi: ["drun", "window", "run"];
icon-theme: "Papirus";
show-icons: true;
}

@theme "/usr/share/rofi/themes/dmenu.rasi"
The final step is to setup our hotkeys for running the applications we use the most. Type in the following command;

nano ~/.config/openbox/rc.xml

search for </keyboard> and add these lines just above that line;

 <!-- Launch rox-filer when windows-f is pressed -->
  <keybind key="W-f">
    <action name="Execute"><command>rox-filer</command></action>
  </keybind>
<!-- Launch rofi when windows-m is pressed -->
  <keybind key="W-m">
    <action name="Execute"><command>rofi -show drun</command></action>
  </keybind>
<!-- Launch firefox when windows-w is pressed -->
  <keybind key="W-w">
    <action name="Execute"><command>firefox-esr</command></action>
  </keybind>
<!-- Launch tilix when windows-t is pressed -->
  <keybind key="W-t">
    <action name="Execute"><command>tilix</command></action>
  </keybind>
<!-- Launch thunderbird when windows-e is pressed -->
  <keybind key="W-e">
    <action name="Execute"><command>thunderbird</command></action>
  </keybind>
<!-- Launch audacious when windows-a is pressed -->
  <keybind key="W-a">
    <action name="Execute"><command>audacious</command></action>
  </keybind>
<!-- Launch vlc when windows-v is pressed -->
  <keybind key="W-v">
    <action name="Execute"><command>vlc</command></action>
  </keybind>
<!-- Launch scrot for screen caps when windows-print is pressed -->
  <keybind key="W-Print">
    <action name="Execute"><command>scrot 'screenshot-%Y-%m-%dT%H%M%S.png'</command></action>
  </keybind>

With this configuration, your keybindings will be as follows.

ROX-filer         windows-f(ile manager)
Rofi                 windows-m(enu)
Firefox-ESR    windows-w(eb)
Tilix                windows-t(erminal)
Thunderbird   windows-e(mail)
Audacious      windows-a(udio)
vlc                  windows-v(ideo)

Switch Desktops;
  ctrl-alt-right
  ctrl-alt-left
Print Screen  windows-prtscn

All that is left to do is right click on the background and choose Exit, this will drop you back to the command line, reboot the system and log back in. Then type startx to get back to your desktop. To run a program you do not have a hotkey for, simply press the Windows Key + m, at the top rofi will appear, simply start typing the name of the program and when it appears, highlight it and press enter.

Keep in mind, this is a very basic and plain setup. As I said earlier, you can set a background picture and you can add some interesting bling using conky. I may go into these things later. But for now, enjoy your minimalist desktop that consumes less than 512 MB of memory.

Tuesday, November 26, 2024

Building a Firefox Kiosk

 In my home lab I have been experimenting with various types of virtual machines. Mostly this has been complete operating systems. However one of the things Broker servers can do for you is give access to single applications, without the need for complete operating systems. Broker software like VMWare Horizon is expensive, but honestly, something like Remmina, which is a multi protocol desktop connection client, serves the same purpose.

In this example, I am setting up Firefox as a app, when the VM is launched Firefox is all the user has access to. If you wanted to, you could install this setup on a PC and just use it as a kiosk, no virtualization is really needed.

The first step is installing Debian 12, you can use Ubuntu server as well. We want a minimal install, no extra software outside of ssh server, not even a desktop environment. The resource requirements are very low; 1 core, 2 GB of RAM and 8 GB of storage will be more than enough. Once you are done, log in as root and install the needed software

apt update && apt upgrade

apt install sudo firefox-esr xorg openbox lightdm tigervnc-standalone-server tigervnc-common

Once that is done you will need to add the kiosk user, which is the account which the system will automatically log into when anyone accesses the virtual machine.

useradd kiosk

Next, enter the kiosk user account;

su - kiosk

Now we are going to make 2 confiuration files, one for VNC so the account can be accessed remotely and one for Openbox, which is the window manager we will use.

mkdir .vnc

nano .vnc/config

Enter the following text into the file, then press ctrl-x, save the file and exit.

session=openbox
geometry=1200x720
localhost
alwaysshared

Then move on to Openbox;

mkdir -p .config/openbox

nano .config/openbox/autostart

Enter the following text into the file, then press ctrl-x, save the file and exit.

env DISPLAY=:1 firefox-esr -kiosk 'http://url' &

If you want to setup a different application, this is the place to do it. Firefox can be replaced with Chrome or LibreCalc, just make sure the appropriate software is installed. Go a head and exit the kiosk user account by typing exit and you will be back in the root account.

We now want to give over display :1 to the kiosk user so when when someone logs in via RDP, Firefox will display on the VNC connection instead of the local display.

nano /etc/tigervnc/vncserver.users

Enter the following text into the file, then press ctrl-x, save the file and exit.

 :1=kiosk

The next step is to make it so the system booting directly into the kiosk user account and starts the VNC server.

 nano /etc/lightdm/lightdm.conf

Go to the bottom of the files and add these lines, then press ctrl-x, save the file and exit;

[SeatDefaults]
autologin-user=kisok
user-session=openbox
[VNCServer]
enabled=true
command=/usr/bin/Xvnc -rfbauth /etc/vncpasswd
port=5901
width=1200
height=720
depth=32

Finally, we want to setup the VNC password, that will be required when the user initiates a VNC connection.

vncpasswd /etc/vncpasswd

Now, reboot the system. On the local display, you will get a blank screen, if you right click on the background, you should get a menu. When you access it with VNC, Firefox should automatically start up in kiosk mode.

Tuesday, November 19, 2024

Installing VNC Server software into Debian 12

 Something that should be easy to do in Linux is getting VNC server software up and running without too much problem, except its not. All the instructions I found used TightVNC or TigerVNC and for whatever reason required the installation of XFCE to make work. XFCE is not bad really, but it is not the desktop environment that I normally used.

This got me to wondering whatever happened to vino, which was a VNC package I used years ago but no longer seemed to be in favor. I looked around and although it is still available it is no longer being maintained. Further, because of a bug, the last person who worked on it, removed the configuration dialog, which forced the user to configure it with a command line tool. Ultimately though, it is still pretty easy to install and get running without all the extra hoops needed for TightVNC or TigerVNC.

sudo apt install vino
gsettings set org.gnome.Vino prompt-enabled false

Then run this command to make sure the prompt is disabled.

gsettings list-recursively org.gnome.Vino

Finally, add this to your startup programs and reboot the system;

/usr/lib/vino/vino-server --display=:0 &

That is pretty much it. You should now be able to access the desktop with Remmia or similar using port 5900.

Mastodon