Hello Stefan, Stefan Kangas writes: > Po Lu writes: > >> The screen number should be the following part of the `display' frame >> parameter: >> >> 1.1.1.1:0.5 >> ^ screen number is 5 >> >> if there is no period after the separator, then the screen number is 0. >> >> The currently active workspace can be obtained like so: >> >> (x-window-property "_NET_CURRENT_DESKTOP" nil "CARDINAL" 0 nil t) >> >> if it fails by returning NULL, then you should fall back to: >> >> (x-window-property "WIN_WORKSPACE" nil "CARDINAL" 0 nil t) >> >> and failing that, 0. >> >> The monitor name should also be easy to extract with >> display-monitor-attributes-list, but if the source is anything other >> than "XRandr", "XRandr 1.5" or "Gdk", you should fall back to using "0". > > Thanks, I've pushed a fix to master based on the above. I very much > appreciated the clear instructions above, which saved me a ton of time. > > I had to jump through extra hoops to get it to work also in the > situation that Thierry described, however. See commit b0289e7f6d and in > particular bb9df76dc9. > > I installed XFCE on my machine to test the change and it works for me. > If someone with XFCE could test that the change works for them, that > would be welcome. It is working fine on graphic display but on emacs -nw there is two problems: 1) The function wallpaper--format-arg is evaluating the format-specs each time it is called and when display-graphic-p returns nil, user is prompted for height and width at each call. Here the xfce args: ("-c" "xfce4-desktop" "-p" "/backdrop/screen%S/monitor%M/workspace%W/last-image" "-s" "%f") We are prompted for height and width for each of these args. Here how you could fix this: diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el index 36bc7e91a69..9ac0fd1dc91 100644 --- a/lisp/image/wallpaper.el +++ b/lisp/image/wallpaper.el @@ -374,8 +374,10 @@ See also `wallpaper-default-width'.") (defun wallpaper--get-height-or-width (desc fun default) (cond ((display-graphic-p) (funcall fun)) - (noninteractive default) - ((read-number (format "Wallpaper %s in pixels: " desc) default)))) + ;; (noninteractive default) + (t + (lambda () + (read-number (format "Wallpaper %s in pixels: " desc) default))))) (autoload 'ffap-file-at-point "ffap") @@ -444,7 +446,9 @@ This is the default function for `wallpaper-set-function'." (let* ((args (if (functionp wallpaper-command-args) (funcall wallpaper-command-args) wallpaper-command-args)) - (real-args (mapcar (lambda (arg) (wallpaper--format-arg arg file)) + (real-args (mapcar (lambda (arg) + (let ((val (wallpaper--format-arg arg file))) + (if (functionp val) (funcall val) val))) args)) (bufname (format " *wallpaper-%s*" (random))) (process 2) display-monitor-attributes-list doesn't return the value of monitor: (display-monitor-attributes-list) On graphic display it is ok: => (((name . "eDP") (geometry 0 0 1920 1080) (workarea 0 0 1920 1080) (mm-size 309 174) (frames #) (source . "XRandr"))) But not on emacs -nw => (((geometry 0 0 238 57) (workarea 0 0 238 57) (mm-size nil nil) (frames #))) As a result the wallpaper is never set on emacs -nw. -- Thierry