;; On Haiku, it uses the `haiku-set-wallpaper' function, which does
;; not rely on any external commands.
;;
+;; On macOS, the "osascript" command is used. You might need to
+;; disable the option "Change picture" in the "Desktop & Screensaver"
+;; preferences for this to work (this was seen with macOS 10.13).
+;;
;; Finding an external command to use is obviously a bit tricky to get
;; right, as there is no lack of platforms, window managers, desktop
;; environments and tools. However, it should be detected
("gsettings" "set" "org.gnome.desktop.background" "picture-uri" "file://%f")
;; KDE Plasma
("plasma-apply-wallpaperimage" "%f")
+ ;; macOS
+ ("osascript" "-e" "tell application \"Finder\" to set desktop picture to POSIX file \"%f\"")
;; Other / General X
("gm" "display" "-size" "%wx%h" "-window" "root" "%f")
("display" "-resize" "%wx%h" "-window" "root" "%f")
(const :tag "xwallpaper (X Window System)" "xwallpaper")
(const :tag "hsetroot (X Window System)" "hsetroot")
(const :tag "xloadimage (X Window System)" "xloadimage")
- (const :tag "xsetbg (X Window System)" "xsetbg"))
+ (const :tag "xsetbg (X Window System)" "xsetbg")
+ (const :tag "osascript (macOS)" "osascript"))
(const :tag "Other (specify)" string))
:set #'wallpaper--set-wallpaper-command
:group 'image
(error "No such file: %s" file))
(unless (file-readable-p file)
(error "File is not readable: %s" file))
+ (wallpaper-debug "Using image %S:" file)
(cond ((eq system-type 'windows-nt)
(w32-set-wallpaper file))
((featurep 'haiku)