]> Sergey Matveev's repositories - nnn.git/commitdiff
wallpaper plugin: add ability to set wallpaper for specific monitors using nitrogen
authorXerillic <xerillic@gmail.com>
Wed, 13 Sep 2023 00:58:37 +0000 (20:58 -0400)
committerXerillic <xerillic@gmail.com>
Wed, 13 Sep 2023 00:58:37 +0000 (20:58 -0400)
plugins/wallpaper

index 2017fbd4d582751b17b130f3cec5c45efb3da9dd..79583aa0cebc42d93ffc0056a6c1544c954d1563 100755 (executable)
@@ -8,11 +8,25 @@
 # Shell: POSIX compliant
 # Author: juacq97
 
+selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
+resp=
+
+add_file ()
+{
+    printf '%s\0' "$@" >> "$selection"
+}
+
 if [ -n "$1" ]; then
     if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
         if [ "$XDG_SESSION_TYPE" = "x11" ]; then
             if type nitrogen >/dev/null 2>&1; then
-                nitrogen --set-zoom-fill --save "$1"
+               printf "Set to full desktop or a specific monitors? [0, 1, etc. Defaults to full.]"
+               read -r resp
+               if [ "$resp" != "" ]; then
+                       nitrogen --set-zoom-fill --save "$1" --head="$resp"
+               else
+                       nitrogen --set-zoom-fill --save "$1"
+               fi
             elif type wal >/dev/null 2>&1; then
                 wal -i "$1"
             else