https://bugs.kde.org/show_bug.cgi?id=487816

            Bug ID: 487816
           Summary: No clean way to change the wallpaper for distributions
    Classification: Plasma
           Product: kwin
           Version: 6.0.5
          Platform: postmarketOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: core
          Assignee: kwin-bugs-n...@kde.org
          Reporter: ollieparan...@postmarketos.org
  Target Milestone: ---

There is no clean way to change the default wallpaper for distributions.

It would be great if there was a simple config file that the distribution could
write, which would then set a different wallpaper as default. (The default
wallpaper of Plasma 6 is really beautiful, but we are looking into setting a
consistent wallpaper across all UIs in postmarketOS, and changing it with every
release.)

For example, with GNOME this can be done by writing a file like this to
/usr/share/glib-2.0/schemas/10_pmOS-wallpaper.gschema.override:

[org.gnome.desktop.background]
picture-uri='file:///usr/share/wallpapers/postmarketos/contents/images/2707x2707.png'
picture-uri-dark='file:///usr/share/wallpapers/postmarketos/contents/images_dark/2707x2707.png'

Doing it for Plasma only seems to work by talking to the D-Bus API within a
running Plasma session. I've done it via the following hack for now:

1. Write to /etc/skel/.config/autostart/set-plasma-wallpaper.desktop:

[Desktop Entry]
Exec=/usr/libexec/postmarketos/set-plasma-wallpaper.sh
Name=Set postmarketOS Wallpaper for Plasma
Terminal=False
Type=Application

2. Write to /usr/libexec/postmarketos/set-plasma-wallpaper.sh:

#!/bin/sh
MARKER=~/.local/state/postmarketos/plasma-wallpaper-has-been-set
WALLPAPER_PATH="/usr/share/wallpapers/postmarketos"

# Only run this script in Plasma sessions. This variable is set in in both
# Plasma Desktop and Plasma Mobile (unlike e.g. XDG_DESKTOP_SESSION).
if [ -z "$KDE_FULL_SESSION" ]; then
        exit 1
fi

# Only run this script once. If the user selects a different wallpaper
# afterwards, it should not be changed.
if [ -e "$MARKER" ]; then
        exit 0
fi

echo "set-plasma-wallpaper: changing to: $WALLPAPER_PATH"

# Unfortunately this fails if the D-Bus API isn't available yet. So we have to
# try multiple times.
for i in $(seq 1 30); do
        sleep 1

        if ! plasma-apply-wallpaperimage "$WALLPAPER_PATH"; then
                continue
        fi

        mkdir -p "$(dirname "$MARKER")"
        touch "$MARKER"
        echo "set-plasma-wallpaper: success"
        exit 0
done

echo "set-plasma-wallpaper: failed"
exit 1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to