|
35 | 35 | # In the end put the path to the actual final wallpaper image file in the WP variable. |
36 | 36 | # The default is to simply set WP=$1. |
37 | 37 | WP=$1 |
| 38 | +SCRIPT_PATH="$(readlink -f "$0")" |
38 | 39 |
|
39 | 40 | detect_desktop() { |
40 | 41 | if [ -n "$XDG_CURRENT_DESKTOP" ]; then |
@@ -152,17 +153,28 @@ if [ "$DE" == "enlightenment" ]; then |
152 | 153 |
|
153 | 154 | elif [ "$DE" == "kde" ]; then |
154 | 155 | plasma_qdbus_script=" |
| 156 | + let supportedPlugins = Array('org.kde.image', 'a2n.blur'); |
| 157 | + let unsupportedPlugins = []; |
155 | 158 | let allDesktops = desktops(); |
156 | 159 | for (let d of allDesktops) { |
157 | | - if (d.wallpaperPlugin == 'org.kde.image') { |
158 | | - d.currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General'); |
| 160 | + if (supportedPlugins.includes(d.wallpaperPlugin)) { |
| 161 | + d.currentConfigGroup = Array('Wallpaper', d.wallpaperPlugin, 'General'); |
159 | 162 | d.writeConfig('Image', 'file://""$WP""'); |
160 | 163 | } |
| 164 | + else if (!unsupportedPlugins.includes(d.wallpaperPlugin)) { |
| 165 | + unsupportedPlugins.push(d.wallpaperPlugin); |
| 166 | + } |
161 | 167 | } |
| 168 | + print(unsupportedPlugins); |
162 | 169 | " |
163 | | - dbus-send --type=method_call --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript string:"$plasma_qdbus_script" |
| 170 | + |
| 171 | + plasma_qdbus_raw_result=$(dbus-send --print-reply --type=method_call --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript string:"$plasma_qdbus_script") |
| 172 | + unsupported_plugins=$(echo "$plasma_qdbus_raw_result" | grep -oP '(?<=string ")[^"]*') |
164 | 173 | dbus_exitcode="$?" |
165 | | - if [[ "$dbus_exitcode" -ne 0 && "${KDE_SESSION_VERSION}" -eq '5' ]]; then |
| 174 | + |
| 175 | + if [[ -n "$unsupported_plugins" ]]; then |
| 176 | + kdialog --title "Variety: unsupported wallpaper plugin" --passivepopup "Unsupported plugin detected: $unsupported_plugins\n----\nTry adding it to the supportedPlugins list in the kde section of $SCRIPT_PATH" --icon variety 30 |
| 177 | + elif [[ "$dbus_exitcode" -ne 0 && "${KDE_SESSION_VERSION}" -eq '5' ]]; then |
166 | 178 | kdialog --title "Variety: cannot change Plasma wallpaper" --passivepopup "Could not change the Plasma 5 wallpaper; \ |
167 | 179 | make sure that you're using Plasma 5.7+ and have widgets unlocked.\n----\n \ |
168 | 180 | Due to Plasma limitations, external programs cannot automatically change the wallpaper when the widgets are locked.\n \ |
|
0 commit comments