Adapt the appearance of the GRUB boot menu, boot screen, and KDE splash screen

Scripting Language

The Script plugin evaluates the instructions in a theme-name.script in the theme folder. The specially developed scripting language is extensive. So let's have a look at the minimalistic Simple-Image [5] theme, which displays a centered image at boot time and does not use any animation.

In as-delivered condition, the graphic shows an Arch Linux logo. To replace it, edit the img.png file in the theme folder or replace it with a PNG with a resolution of 1920 x 1080 pixels. You must reinstall the theme after each change to the image. With an absolute minimum of script code, Simple Image is a good basis for experiments.

The content of the simple-image.plymouth theme configuration file is shown in Listing 1. The configuration provides a name and description and selects the Script plugin. The [script] configuration block for the plugin specifies the directory for the image to be displayed and the name of the script file. To create a new theme, simply adjust these paths and the file name of the .plymouth file itself to match the theme name you have chosen.

Listing 1

simple-image.plymouth

[Plymouth Theme]
Name=Arch Linux Simple Image
Description=This is a plymouth theme which simply displays an image
ModuleName=script
[script]
ImageDir=/usr/share/plymouth/themes/simple-image
ScriptFile=/usr/share/plymouth/themes/simple-image/simple-image.script

You can see the simple-image.script file in Listing 2. It creates an image object and calculates the screen center (lines 1 to 4). In computer graphics and also in Plymouth scripts, a sprite is a moving image object (line 6). Lines 7 and 8 place its coordinates at the computed center of the display. The last line defines RefreshFunction as the refresh_callback, which is called at each step of the boot process. Here it simply sets the opacity of the image to 1 and the stacking order to 15.

Listing 2

simple-image.script

01 image = Image("img.png");
02
03 pos_x = Window.GetWidth()/2 - image.GetWidth()/2;
04 pos_y = Window.GetHeight()/2 - image.GetHeight()/2;
05
06 sprite = Sprite(image);
07 sprite.SetX(pos_x);
08 sprite.SetY(pos_y);
09
10 fun refresh_callback () {
11   sprite.SetOpacity(1);
12   spr.SetZ(15);
13 }
14
15 Plymouth.SetRefreshFunction (refresh_callback);

You can extend this rudimentary framework by elaborating on the refresh_callback() function. You could successively increase the Opacity from   to 1, fade in more images, or move sprites over the screen with algorithms of arbitrary complexity using SetX() and SetY(). The script plugin documentation lists all the available commands.

Yet Another Splash Screen

The display manager starts after the boot splash. For KDE, openSUSE installs SDDM (Figure 6). When starting KDE, you will then see a second splash screen (Figure 7). The background image of the KDE login manager can be easily changed in the desktop environment's settings tool. This is all it takes to adjust the login screen to match the rest of the graphical design, as the login screen controls use a neutral look by default.

Figure 6: The green background of the KDE login screen can be changed with just a few clicks in the system settings.
Figure 7: Writing a theme for the KDE start screen requires QML programming skills if you want to do more than simply replace the graphics that are displayed.

The KDE start screen, on the other hand, does not easily fit into a customized look. Newer KDE versions include a download function for themes in the system settings, as in many other places. This is still missing from openSUSE Leap 15.1, but it's not difficult to download and install themes manually from Pling.com [6]. Just unpack the zip archives in the ~~/.local/share/plasma/look-and-feel/ directory; you might need to create look-and-feel/ first.

The start screens are written in QML, an interface description language provided by the Qt GUI framework used by KDE. To even touch on the Qt feature set would go beyond the scope of this article. However, QML startup screens can be "hacked" in a similar way to Plymouth boot screens by changing the graphics in the Theme-Name/contents/splash/images/ folder.

As soon as you hover the mouse pointer over the preview of a Start Screen Design, a play symbol appears that starts the boot animation for testing purposes. This makes it quite easy to see which graphics from the images/ subfolder appear at which position in the start screen.

Conclusions

Adapting the KDE desktop to your own taste is a breeze. The GRUB boot menu, the boot splash animation, and the KDE start screen are a bit trickier. To install themes found on the Internet, all you have to do is choose the right folder to store the themes, and, in the worst case, you may need to know the right YaST module or command.

It is not quite as easy to create your own themes for these three system design elements. The best way to get started is to modify existing themes using the templates available on the Internet. Even with minor adjustments, you can achieve a customized, seamless look for the system.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News