]> Sergey Matveev's repositories - nnn.git/commitdiff
fix plugins/wallpaper support for wayland
authorDarukutsu <darupeter@pm.me>
Tue, 1 Nov 2022 15:40:25 +0000 (16:40 +0100)
committerDarukutsu <darupeter@pm.me>
Tue, 1 Nov 2022 15:40:25 +0000 (16:40 +0100)
plugins/wallpaper

index 5940df1906d387c2a75998c40ef2e65e03a496cb..c6ff2455606199d08814b2099420004a754a100f 100755 (executable)
@@ -9,14 +9,24 @@
 
 if [ -n "$1" ]; then
        if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
-        if type nitrogen >/dev/null 2>&1; then
-               nitrogen --set-zoom-fill --save "$1"
-        elif type wal >/dev/null 2>&1; then
-               wal -i "$1"
-        else
-            printf "nitrogen or pywal missing"
-            read -r _
-        fi
+         if [ "$XDG_SESSION_TYPE" == "x11" ]; then
+           if type nitrogen >/dev/null 2>&1; then
+                   nitrogen --set-zoom-fill --save "$1"
+           elif type wal >/dev/null 2>&1; then
+                   wal -i "$1"
+           else
+               printf "nitrogen or pywal missing"
+               read -r _
+           fi
+         else
+           if type swww >/dev/null 2>&1; then
+                   swww img "$1"
+           else
+               printf "swww missing"
+               read -r _
+           fi
+         fi
+
 
     # If you want a system notification, uncomment the next 3 lines.
     # notify-send -a "nnn" "Wallpaper changed!"