Skip to content

Commit 18b5a10

Browse files
seanjseymourjlu5
authored andcommitted
Add support for KDE Active Blur wallpaper plugin
Co-Authored-By: James Lu <james@overdrivenetworks.com> Closes varietywalls#814.
1 parent c7d6eb2 commit 18b5a10

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

variety/data/scripts/set_wallpaper

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
# In the end put the path to the actual final wallpaper image file in the WP variable.
3636
# The default is to simply set WP=$1.
3737
WP=$1
38+
SCRIPT_PATH="$(readlink -f "$0")"
3839

3940
detect_desktop() {
4041
if [ -n "$XDG_CURRENT_DESKTOP" ]; then
@@ -152,17 +153,28 @@ if [ "$DE" == "enlightenment" ]; then
152153

153154
elif [ "$DE" == "kde" ]; then
154155
plasma_qdbus_script="
156+
let supportedPlugins = Array('org.kde.image', 'a2n.blur');
157+
let unsupportedPlugins = [];
155158
let allDesktops = desktops();
156159
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');
159162
d.writeConfig('Image', 'file://""$WP""');
160163
}
164+
else if (!unsupportedPlugins.includes(d.wallpaperPlugin)) {
165+
unsupportedPlugins.push(d.wallpaperPlugin);
166+
}
161167
}
168+
print(unsupportedPlugins);
162169
"
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 ")[^"]*')
164173
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
166178
kdialog --title "Variety: cannot change Plasma wallpaper" --passivepopup "Could not change the Plasma 5 wallpaper; \
167179
make sure that you're using Plasma 5.7+ and have widgets unlocked.\n----\n \
168180
Due to Plasma limitations, external programs cannot automatically change the wallpaper when the widgets are locked.\n \

0 commit comments

Comments
 (0)