1

During boot I see the usual messages on TTY. After that, when X starts, xfce & xfdesktop sets a solid color as background.

I do not use the background, I do not have icons on my desktop. It would look cool if the boot-messages stayed there even after X is started. Is there a way to achieve that?

1
  • That would be cool. But if there's an easy answer without, then no.
    – sheß
    Sep 22, 2018 at 5:22

3 Answers 3

2
+50

I'll provide two ways of generating an approximation of the boot messages as the desktop background, one dynamic and the other static.

Both methods require systemd to be installed and read access to system logs via journalctl. Minimal privileges for running journalctl can be provided through membership in the systemd-journal group, e.g., usermod -aG systemd-journal YOUR_USERNAME followed by a logout and login.


Dynamic boot log background

The basic idea is to run an undecorated terminal at the bottommost window layer to display log contents. For simple window managers like fluxbox, this can be achieved by setting the stacking order of a sticky maximized terminal to "Desktop" and running journalctl ..., optionally automating the configuration through the window manager's startup hooks.

On the other hand, maximizing a window in Xfce leaves the vertical area of the desktop behind the dock uncovered, so the user will need to manually figure out the geometry of the terminal necessary to cover the entire screen, which will mostly be determined by font settings and screen resolution. A good way to get an approximation is to run

xfce4-terminal --fullscreen --hide-menubar --hide-borders --hide-toolbar --hide-scrollbar

and check what the terminal decided on:

$ echo $COLUMNS
102
$ echo $LINES
40  # maybe subtract one to compensate for the height of the taskbar

The following helper script, which not meant to be run manually (see the xfce4-terminal ... command below), will then be used to set a terminal with the title of "journalterm" to be sticky, omitted from the taskbar and application switcher, below other windows, and execute journalctl ...:

#!/bin/bash

xdotool search --name journalterm;  # wmctrl focus bug?
for i in below skip_{pager,taskbar} sticky; do
    wmctrl -v -r journalterm -b add,$i;  # comment out -v for quiet
done

tput civis;  # hide the terminal cursor

[JOURNALCTL_CMD]

where [JOURNALCTL_CMD] should be replaced with

exec journalctl --lines=all --follow

or

journalctl --lines=all --follow --no-hostname -oshort-unix \
    |stdbuf -i0 -oL -eL cut -d\  -f1 --complement \
    |grep --line-buffered -F 'systemd[1]' \
    |sed -uE "s/systemd\[1\]:/\[  `printf '\033[00;32m'`OK`printf '\033[00m'`  \]/g"

The former journalctl ... simply outputs the system logs

System logs as the background

while the latter will mimic the systemd output during the last stages of system boot and might skip some messages that were displayed during the actual boot process for simplicity's sake.

systemd output as the background

stdbuf removes buffering from cut, while grep and sed have their own native parameters for forcing new output from systemd to be displayed to the terminal as soon as it's ready.

Then, the command to run the above script should be as follows, with [C] and [L] replaced with the column and line counts that were figured out earlier, respectively:

xfce4-terminal -T journalterm --geometry=[C]x[L] --hide-menubar --hide-borders --hide-toolbar --hide-scrollbar --execute /path/to/the/above/script

This can be automatically launched at login via the addition of an entry executing the above line in Session and Startup > Application Autostart.


Static boot log background

Static systemd output background

The following script will generate a PNG of systemd's most recent messages:

#!/bin/bash

exec xfce4-terminal --fullscreen --hide-menubar --hide-scrollbar --execute \
    bash -c \
    "tput civis; PS1=; \
    journalctl --no-hostname -oshort-unix \
    |cut -d\  -f1 --complement \
    |grep -F 'systemd[1]' \
    |sed -E \"s/systemd\[1\]:/\[  `printf '\033[00;32m'`OK`printf '\033[00m'`  \]/g\" \
    |head -c-1; \
    read -t1; import -window root systemd-`date +%s`.png";

Note that the PNG is generated by taking a screenshot of a fullscreen terminal, so interacting with the system while this is happening is not recommended, though the delay caused by read .. can be lowered on faster systems to reduce the wait time. As with the above xfce4-terminal ... command, this script can run by Xfce automatically to generate a fresh static image of systemd messages on every login, if desired. Xfce will notice if the file providing the desktop background has changed and update the wallpaper accordingly, so adjusting import to write to the same file every time might be useful depending on the use case.

The above script only requires a terminal that knows how to go fullscreen and run a script. For instance, the exec xfce4-terminal ... line can be replaced with xterm -fullscreen -e \ and the script will still run as expected.

3
  • 1
    Wow. Great Ideas! Here's a weid suggestion: Would it be somehow possible to start screen somewhere early during the bootprocess, have the backgrouund-fullscreen terminal access that screen session and thus have it actually interactive?
    – sheß
    Sep 28, 2018 at 19:19
  • With interactive that it actually behaves as what you see when you use crtl+alt+f2/f1, i.e. being able to login etc
    – sheß
    Sep 28, 2018 at 20:50
  • Oh, now, I don't want that. I simply wan't it to look and have like what you see when you go press [alt]+[ctrl]+[f2], not starting an x server or the like. merely being able to login via the console
    – sheß
    Sep 28, 2018 at 21:29
1

The following command updates the image on the root window with an image of the virtual terminal text contents every 5 seconds:

$ sudo watch -n 5 myscript.sh

Where myscript.sh is:

#! /bin/bash

# Dump vt1 console to a file
setterm -dump 1 --file ~/screen.dump

# Get the screen resolution, e.g. 1920x1080 (there may be an easier way, but...)
RESOLUTION=xdpyinfo | grep dimensions | cut -d : -f 2 | cut -d p -f 1 | tr -d [:space:]

# Convert the text file to a png image
convert -size $RESOLUTION xc:black -font "FreeMono" -pointsize 12 -fill white -annotate +15+15 "@screen.dump" ~/screen.png

# Send it to the root window
xli -onroot -quiet -fillscreen ~/screen.png
2
  • That's already pretty cool. Unfortunately soffice creates the png a portrait format (or whatever the default is). Also, one drawback is that the layout changes compared to what it was during boot (colors, but also spacing etc)
    – sheß
    Sep 27, 2018 at 18:19
  • 1
    Ok, I have changed the answer to use "convert" so that you can specify the resolution of the screen. About preserving the colors, I have to think a little bit more. Sep 27, 2018 at 19:15
0

One answer could be to build a VM and while this VM boots, take a screenshot of it. Put that screenshot as background image.

1
  • 1
    Yes, but a bit impractical
    – sheß
    Sep 26, 2018 at 4:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .