emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2e0cde244a: Support macOS in wallpaper.el


From: Stefan Kangas
Subject: master 2e0cde244a: Support macOS in wallpaper.el
Date: Thu, 15 Sep 2022 12:35:08 -0400 (EDT)

branch: master
commit 2e0cde244a99b83b221dc5ecce24167bf4bc1a5d
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Support macOS in wallpaper.el
    
    * lisp/image/wallpaper.el (wallpaper--default-commands)
    (wallpaper-command): Support macOS using "osascript".
    (wallpaper-set): Display image name when wallpaper-debug is t.
---
 lisp/image/wallpaper.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el
index b5ce7355cd..d024d6238c 100644
--- a/lisp/image/wallpaper.el
+++ b/lisp/image/wallpaper.el
@@ -31,6 +31,10 @@
 ;; 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
@@ -57,6 +61,8 @@
     ("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")
@@ -157,7 +163,8 @@ native API will be used instead (see 
`haiku-set-wallpaper')."
      (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
@@ -241,6 +248,7 @@ On Haiku, no external command is needed, so the value of
     (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]