Skip Navigation

Assignment 10: Install KDE Plasma

For this assignment, you will install and run the KDE Plasma desktop using Wayland. You’ll also install the Firefox and Falkon Web browsers and learn to use the screenshot tool (Spectacle) in KDE Plasma.

Page Contents

Background

In the early days of computing, punched paper tapes were used for data input and output. Eventually, these paper tapes gave way to punched paper cards for input and printed text (also paper) for output. Paper later gave way to keyboard and magnetic storage (disk) input and Cathode Ray Tube (CRT) monitor output (which was derived from early television and radar work). Until the 1980s, computers primarily worked in text for input and output. Commands were given in text, and the results were displayed in text. Some special-purpose applications could draw graphics to a plotter, and rudimentary ways of drawing shapes on CRT monitors also developed.

By the 1980s, the modern Graphical User Interface (GUI) began to come into use. Xerox developed many of the GUI concepts we use today during the 1970s, and these eventually reached commercialization with Apple computers in the early 1980s. Microsoft released Windows 1.0 in late 1985. At the same time, a group of MIT researchers developed what would become the X Window System in 1984, building upon Stanford research from the early 1980s. Version 11 of the X Window System protocol became standardized as X11 and has been in use on UNIX systems ever since. From 1991, XFree86 was the standard distribution of software that implemented the server side of the X11 protocol on Linux computers. After a licensing dispute in 2004, most of the developers left the XFree86 project and forked the code as X.org.

The X11 protocol contains numerous functions that are outdated today, such as drawing primitive shapes and rendering ugly bitmap fonts. To escape the technical debt of the old protocol, a group of developers created Wayland as a replacement protocol in 2008. Since that time, GUI development effort for Linux has gradually shifted from X11 to Wayland, leaving X.org “largely abandoned” since 2020. Although progress in migrating to Wayland has picked up pace in recent years, there are still some issues with the new protocol. Worse, the issues vary by compositor, which is what a piece of software implementing the server side of the Wayland protocol is called. Unlike X.org, which was the server component for the X11 protocol, there is no single compositor implementation for Wayland. Instead, each developer who wants to build a Wayland GUI implements their own compositor. On the plus side, some compositors develop features more quickly with this approach. The downside is fragmentation and feature disparity between GUI implementations.

Window Managers and Desktop Environments

In the X.org days, Linux users had a wide selection of window managers from which to choose, including ones like Openbox, IceWM, and i3. By running a window manager with a file manager and other independent programs, a user could create a custom desktop environment. Window managers came in two major varieties: stacking and tiling. In a stacking window manager, windows can overlap, and the user is typically responsible for arranging windows on the screen. Microsoft Windows, macOS, Openbox, and IceWM are all examples of the stacking approach. In contrast, tiling window managers like i3 do not allow windows to overlap, and they have more automation for organizing windows on the screen (at the expense of less flexibility for the user).

Over time, preconfigured sets of applications generally consisting of a window manager, file manager, and related tools were bundled together into desktop environments. Examples of desktop environments include KDE Plasma, GNOME, and Xfce, among others. Desktop environments typically provide a unified experience with minimal setup effort at the cost of lower customization.

Today, KDE and GNOME are arguably the most dominant desktop environments, although they are certainly not the only ones. Both desktop environments have well-developed Wayland compositors and have reached the point of usability with Wayland instead of X11. There are also some standalone Wayland compositors that try to fill the role of old X11 window managers, including LabWC and Wayfire. While these compositors have seen quite a bit of development, standalone applications for implementing the remaining components seem to be lagging behind. As such, GNOME and KDE currently provide the best user experience with Wayland.

Browsers

Fortunately, most of the Web browsers on Linux now work fine under either Wayland or X11. On our Raspberry Pi Alpine installations, we’re only limited by the browsers available in the Alpine Linux package repositories, which carry a limited selection. More browsers could be installed using Flatpak, but we aren’t going to get quite that far this semester.

Instead, we’ll install two graphical browsers in this assignment (and we still have Lynx available from the previous assignment). The first browser is Mozilla Firefox, which I still recommend as a primary browser for privacy reasons (sign up for CSCI 435 for more details). Firefox uses the Gecko engine, which Mozilla developed.

The other browser we’re going to install is Falkon, which uses QtWebEngine as its underlying engine. QtWebEngine is derived from Chromium, which is the upstream open-source project from which Google Chrome is built. Ironically, Google built Chrome by forking Apple WebKit, which is the engine behind the Safari browser. Not to be outdone, Apple built WebKit by forking the KHTML (and KJS) engines from the Konqueror browser. Konqueror, in turn, was originally developed as part of KDE! Thus, the Falkon browser – which is also developed by the KDE project – is based on an engine derived from Chromium, which was based on WebKit, which was forked from an engine used in Konqueror, which was originally developed by the KDE project. Welcome to open-source software. And it doesn’t even stop there, since Microsoft based Edge off Chromium, which we can of course trace back to KDE. (They also seem to have ripped off some of KDE Plasma’s user interface in Windows 11, but to be fair, the original version of KDE ripped off a lot of things from Windows 95.)

Procedure

This section is structured as a tutorial. Please read slowly and carefully enter commands.

Step 0. Read the Background Section

If you skipped down to this point, go read the Background section above, and also read the pages linked from the background material. It’s important to understand why we’re making the choices we’re making in this assignment.

Step 1: Update the System

Log into your Pi as your regular user (not root). Update all the system packages first, since we’re going to be installing additional packages. The commands to update are:

doas apk update
doas apk upgrade

If you see the linux-rpi5-teal package get upgraded, then you also need to reboot onto the new kernel.

In the event that you get any errors at this step, run the nmtui command to troubleshoot your network connection. If you’re using a wired connection, be sure you plugged in the network cable.

Step 2: Install Plasma Desktop

For this step, we’re going to install the Plasma part of KDE Plasma. We’ll get the KDE part (the applications) in the next step. Run:

doas apk add plasma-desktop-meta xf86-input-libinput

Step 3: Install KDE Applications

For this step, you will need to decide which set of KDE applications you would like to install. To make your decision, open an extra browser tab to the Alpine Linux Package Index. On the Alpine Linux Package Index tab, change the Alpine version from Edge to v3.20 (first dropdown box in the Package filter section), and change the architecture (third dropdown box in the Package filter section) to aarch64. In the package name box, type:

kde-applications-*

Now look at each package in the list. If you click on the kde-applications-games package, you will see a package details page. On the right side of that page, there is a dropdown labeled “Depends”. If you open that dropdown, you will see that this package will install no other packages. If you click the “Contents of package” link at the bottom, you will see that this package contains no files. Since this package doesn’t actually install anything, there isn’t any point in installing kde-applications-games!

Go back to the list of kde-applications-* packages, and do the same thing for kde-applications-base. Note that it depends on a number of other packages. If you click on the “ark” package at the top of the list, you will see that the description of this package indicates that it is a graphical program for handling compressed files (like zip files, for example). This program sounds useful. If you back up to the kde-applications-base package again and take another look at its Depends list, you will also see the “dolphin” package listed there. That’s KDE’s file manager, so you definitely want it.

You can either cherry pick the kde-applications-* packages you want, or you could even drill down and pick up a minimal set of programs instead of using these packages at all. The kde-applications-* packages are known as metapackages, since they really only exist to supply a list of dependencies to install.

Once you’ve decided what parts of KDE you want, install the relevant packages. As a hint, I would install (at a minimum) kde-applications-base and kde-applications-admin. However, the choice is up to you as long as you get the minimal applications required to complete this assignment.

Remember that you use the apk add command to install packages on Alpine Linux.

Step 4: Configure Application Scaling

In the event that you have a 4K monitor/TV or decide to connect an Alpine-powered Pi to one in the future, you may find that the KDE panel is a bit too small at the bottom. To rectify this situation, I like to drop in a configuration script that KDE will execute at startup. This script sets the environment variable PLASMA_USE_QT_SCALING to 1, improving the 4K experience.

KDE reads startup scripts from a location that is normally written in documentation as XDG_CONFIG_HOME/plasma-workspace/env. The value of XDG_CONFIG_HOME on basically any Linux system is $HOME/.config, which refers to a hidden .config directory in the user’s home directory. Technically, the system administrator can define another directory instead, but there would rarely be any reason to do so.

We need to create the plasma-workspace environment scripts directory first, since it doesn’t yet exist. Then, we can open Neovim to create our script:

mkdir -p $HOME/.config/plasma-workspace/env
nvim $HOME/.config/plasma-workspace/env/scaling.sh

The script only needs to contain one line:

export PLASMA_USE_QT_SCALING=1

Step 5: Install Browsers and VLC

By default, KDE Plasma will not come with a Web browser. We’re going to install two of them: Firefox and Falkon. Let’s also get the VLC media player while we’re at it:

doas apk add firefox falkon vlc

Step 6: Create a Launch Script for KDE Plasma

We can’t quite launch KDE Plasma directly, since we need to be sure that the D-Bus session bus is running first, and nothing starts it by default. The most reliable way I’ve found to ensure that it gets started is to create a create a wrapper script, which I usually name “startkde”. Let’s create this this file in /tmp (the temporary directory) initially:

nvim /tmp/startkde

Into this file, carefully add the following script content. If the spell checker is annoying, remember that you can run :set nospell from normal mode to turn it off.

#!/bin/sh

dbus=

if [ -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
    dbus=dbus-run-session
fi

exec ${dbus} startplasma-wayland "$@"

Double-check your work! Be sure that you didn’t add any extra spaces around the = signs. Unlike Python, shell scripts do not permit spaces in variable assignment statements. Also check the first line of the file to be sure it says #!/bin/sh exactly. This line is called the “shebang line,” named for the British “hash” (#) and “bang” (!) characters. When we run the startkde command, the Linux kernel opens our script file and sees this line. In turn, this shebang line instructs the kernel to use /bin/sh to interpret this script. Without this line, the kernel won’t know what to do with our file. Once you’re sure you have the code correct, save the file and quit Neovim.

To make the script available, we first need to put it into a location where the system can find it. Since this is a script we wrote, we’re going to put it in /usr/local/bin. We also need to set its ownership to the root user and group, and we need to give it execute permissions. Run the following commands to perform these tasks:

doas mv /tmp/startkde /usr/local/bin/startkde
doas chown root:root /usr/local/bin/startkde
doas chmod 755 /usr/local/bin/startkde

Step 7: Start the Desktop Environment

To be sure that our shell can “see” our new launch script, run:

rehash

Once that’s done, you should be able to start the desktop environment using:

startkde

After a brief delay, you should have a shiny new desktop environment! If not, then please recheck the previous steps (and the steps from the previous assignment), as you may have missed something important.

Step 8: Open System Settings

On the panel at the bottom of the screen, you will see some icons on the left side. The first icon is the menu, which works the same way as the Windows start menu, only with a lot less clutter and no advertising. The second icon, which is a dark-colored square with some sliders on it, opens the System Settings dialog. Click this icon to open System Settings.

In the following steps, we’re going to change just a few of the settings for the purposes of this assignment. To navigate between settings categories, click the category on the left side of the System Settings window. Be sure to click the Apply button to save settings before changing categories, or you will get a popup dialog asking you if you want to save the changed settings.

Step 9: Set a Teal and Bronze Theme

Navigate to Colors & Themes under the Appearance & Style header. Click the little right arrow icon next to the Colors & Themes text to open all the theme settings.

  1. Leave the Global Theme set to Breeze.
  2. Under Colors, select the Breeze Classic theme. Then, click the little pencil icon in the lower right corner of the box for the Breeze Classic theme.
  3. In the dialog that appears, scroll down to the entry for Active Titlebar, and click the little grayish color box on the right side of the entry.
  4. A color picker dialog will appear. Go down to the HTML box near the bottom right, and enter #006f71. Press the Enter key to accept and set the Active Titlebar to teal.
  5. Scroll down to Inactive Titlebar. Click the light gray box on the right side of this entry. Do the same thing with the color picker, except enter the HTML code #a27752 for bronze.
  6. Click the Save As… button at the bottom of the dialog. You will be prompted for a name. Enter CCU and press Enter. Click the close button at the bottom of the dialog.
  7. Back in the Colors settings, click on the CCU color scheme box (NOT the pencil or trash can icons!). Click Apply. You should now have a teal window title bar.

Use the little left arrow icon in the upper left corner of the System Settings window to navigate back to the main list of settings. Scroll down and click Search. The File Search settings are shown.

On the Raspberry Pi, we want to disable file search indexing to prevent unnecessary writes to the MicroSD card. To do this, UNcheck the box next to Enabled, and click Apply. You can then click the Delete Index Data button that appears to clean up any existing index file.

Note that I always disable file search, since it creates forensically recoverable artifacts that could be used by an attacker who gains access to the computer. Some people appreciate having desktop search, and it’s usually really a matter of personal preference. On the MicroSD card, we really need to limit writes, and turning off that feature disables constantly updating the search database.

Step 11: Region & Language

Back up to the main list of settings, and go down to Region & Language. Use the various Modify buttons to change these settings. Ignore any error or warning messages you see. Note that the changes won’t take effect immediately.

Change each of the categories to the American English setting. Click the Apply button when finished with all 6 categories (Language, Numbers, Time, Currency, Measurements, and Paper Size).

To make these changes effective, we need to restart Plasma. To do this, first close the System Settings window. Then, go to the menu in the lower left corner of the screen (where the Start menu would be on Windows) and pick the small left-facing arrow inside the circle that is just to the right of the Shut Down button. Pick Log Out from that menu.

You can either wait 30 seconds or click the Log Out button to exit Plasma.

Run your startkde command again to restart. You may need to press Enter to get a shell prompt that is free of junk before typing it (or using the up arrow for shell history). Plasma may take a while to restart while it generates some of its locale files, but once it finishes, you should see the time and date displayed on the panel in the typical US format.

Step 12: Spell Check

Spell check is a useful feature to have, but we need to enable it first. Open the System Settings again. Navigate down to the Spell Check settings.

  1. Under Preferred Languages, check the box next to American English.
  2. Check the box next to Automatic spell checking enabled by default.
  3. Press the Apply button.

Due to a quirk in the underlying QtWebEngine implementation, a different spell check file is needed for the Falkon browser.

Start Falkon by going to the menu and looking under the Internet category.

You will be prompted to create a KDE Wallet keyring. Pick the classic blowfish encrypted file option. When prompted for a keyring password, just press Enter. Don’t use the KDE Wallet keyring for anything important, as it won’t be encrypted. (I wouldn’t recommend using it anyway, as KeePassXC is a better option.)

Click the Falkon hamburger menu and go to Preferences. Go down to Spell Check and note that /usr/share/qt6/qtwebengine_dictionaries is one of the search locations for spell check files. Click Cancel to close the dialog.

Open a Konsole (terminal) window by going to the menu, navigating to the System category, and picking Konsole. If Konsole is missing, then you probably need to install some more KDE packages: exit KDE and see Step 3 :-).

In the Konsole window, run the following command:

doas mkdir /usr/share/qt6/qtwebengine_dictionaries
doas /usr/lib/qt6/libexec/qwebengine_convert_dict \
    /usr/share/hunspell/en_US.dic \
    /usr/share/qt6/qtwebengine_dictionaries/en_US.bdic

Note that the backslashes (\) in the second command are line continuation markers, which I used due to the length of the things that needed to be typed. You can type out the whole command on one line, leaving out the backslashes. Check that you see the green square root symbol (or whatever success symbol you used in Assignment 8) on the next prompt line showing the command was successful. If you got an error code, double-check your work and re-run the command(s) as needed.

Now you should be able to open Falkon preferences and enable spell check for the English, United States dictionary.

Step 13: Change the Wallpaper

The default wallpaper could use a bit of work. In addition, if you run with the default wallpaper, it will be changed automatically whenever KDE Plasma gets upgraded. To fix these issues, right click anywhere on the desktop, and pick Configure Display and Wallpaper.

You can select one of the other wallpapers included with Plasma. If you prefer to use your own wallpaper, download it with Firefox or Falkon, then use the Add button on the wallpaper dialog to add it to the list. Select the wallpaper you want by clicking the corresponding thumbnail, then click OK.

Step 14: Optional Customizations

You can now make any customizations you would like to make to your desktop. If you don’t like the color scheme or want to use a dark theme, create your submission screenshot (below) first.

Submission Checklist

On your KDE Plasma desktop, open a Konsole window and run the following commands:

hostname
date

Do NOT use your phone to take a screenshot this time, as we now have a better way. See below.

How to Check Your Work

To verify that you have everything working properly, look at the output of the above commands:

  1. Be sure that KDE Plasma is running.
  2. Be sure that your CCU username is part of your hostname in the Konsole window.
  3. Be sure that the date shows a time during the period for this assignment this semester.
  4. Check that the color of the title bar in your active window is teal.
  5. Check that the date and time in the lower right corner of the screen are following the US format. The time should be in a format like “3:03 PM”, and the date should be in a format like “11/5/24”.

Final Steps

Do NOT use your phone for this step!

Instead, press the Print Screen key located in the upper right portion of your keyboard (labeled PrtScn on the Raspberry Pi keyboard, if you have it). The Spectacle program should start, and you should see that it has captured your screen. Click the Save button at the top of the window. If you click the Open Containing Folder button that appears, you will see that the screenshot has been saved in the Pictures/Screeshots subdirectory of your home directory.

Open Firefox or Falkon on your Pi, and go to https://moodle.coastal.edu. Log in to Moodle as usual, and navigate to the assignment submission. Upload the screenshot you just created as the submission for this assignment. Skip down and read the Returning the Pi section below.

No Spectacle?

If you customized your package set extensively, you may have omitted the screenshot tool. In the event that the Print Screen key isn’t working, run the following command in a Konsole window:

doas apk add spectacle

You might need to log out of KDE and log back in to get it working. In this case, you’ll need to redo the Submission Checklist above.

Returning the Pi

If you have this assignment finished before the last day of class, you can return your borrowed equipment on the last day. Otherwise, we’ll figure out a way for you to return it during exam week.

In the meantime, I suggest playing around with KDE Plasma and considering whether or not you could use this desktop environment as your daily driver. With Microsoft insisting on pushing Recall to Windows 11 and Windows 10 going end of life in October 2025, now would be a good time to consider switching to a Linux desktop. While the Raspberry Pi is too underpowered to use as a replacement for your main computer, you can still run KDE Plasma on Linux on an x86_64 system. If you liked Alpine Linux, you now know the main steps required to install and configure it on any architecture, and you should be able to fill in the rest using the Alpine Wiki. However, it is far from the only choice of Linux distribution, and you can take a look at DistroWatch.com to see alternatives.

Congratulations on reaching the end of the project! You have successfully built a Linux desktop using Alpine Linux and starting from the command line. Many of the concepts of this project are portable to other Linux distributions, but don’t forget your Alpine apk command. It may prove useful the first time you need to modify a Docker container.

ABET Assessment

Successful completion of this assignment satisfies the following performance indicator: