Skip to content

Commit

Permalink
Add support for setting the wallpaper in Plasma 6 (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
guss77 authored Jan 4, 2024
1 parent e8580e9 commit 9e0723c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions data/scripts/set_wallpaper
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,21 @@ fi
if [ "${KDE_FULL_SESSION}" == "true" ]; then
# Plasma 5.7 introduced a new feature to set the wallpaper via a dbus script:
# https://github.com/KDE/plasma-workspace/commit/903cbfd7e267a4812a6ec222eb7e1b5dd775686f
if [[ -n "${KDE_SESSION_VERSION}" && "${KDE_SESSION_VERSION}" == '5' ]]; then
dbus-send --type=method_call --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript string:"
plasma_qdbus_script="
let allDesktops = desktops();
for (let d of allDesktops) {
if (d.wallpaperPlugin == 'org.kde.image') {
d.currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General');
d.writeConfig('Image', 'file://""$WP""')
d.writeConfig('Image', 'file://""$WP""');
}
}
"
"
if [[ -n "${KDE_SESSION_VERSION}" && "${KDE_SESSION_VERSION}" -ge '5' ]]; then
dbus-send --type=method_call --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript string:"$plasma_qdbus_script"
# Reuse the exit code from dbus
dbus_exitcode="$?"

if [[ "$dbus_exitcode" -ne 0 ]]; then
if [[ "$dbus_exitcode" -ne 0 && "${KDE_SESSION_VERSION}" -eq '5' ]]; then
# If the script fails, show a notification.
kdialog --title "Variety: cannot change Plasma wallpaper" --passivepopup "Could not change the Plasma 5 wallpaper; \
make sure that you're using Plasma 5.7+ and have widgets unlocked.\n----\n \
Expand Down

0 comments on commit 9e0723c

Please sign in to comment.