unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thievol@posteo.net>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
Subject: Re: master fe7c015b20: Support XFCE in wallpaper.el
Date: Tue, 27 Sep 2022 07:21:23 +0000	[thread overview]
Message-ID: <87y1u51ddf.fsf@posteo.net> (raw)
In-Reply-To: <CADwFkmmHpeEr_rT24Daa-3D7Q85sy0HeF-P_OcX9Z5ard_hMaw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3647 bytes --]


Hello Stefan,

Stefan Kangas <stefankangas@gmail.com> writes:

> Po Lu <luangruo@yahoo.com> 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 #<frame  *Minibuf-1* - GNU Emacs at IPad-S340 0x55d6b2418828>)
  (source . "XRandr")))

But not on emacs -nw
=> (((geometry 0 0 238 57) (workarea 0 0 238 57) (mm-size nil nil) (frames #<frame F1 0x5636347dc460>)))

As a result the wallpaper is never set on emacs -nw.


-- 
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

  parent reply	other threads:[~2022-09-27  7:21 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166336105908.23797.12319380359602540227@vcs2.savannah.gnu.org>
     [not found] ` <20220916204419.B124FC00872@vcs2.savannah.gnu.org>
2022-09-17  2:00   ` master fe7c015b20: Support XFCE in wallpaper.el Po Lu
2022-09-17 18:03     ` Stefan Kangas
2022-09-18  1:18       ` Po Lu
2022-09-18  2:13         ` Po Lu
2022-09-18  4:48         ` Thierry Volpiatto
2022-09-18  5:15           ` Po Lu
2022-09-18 14:44             ` Thierry Volpiatto
2022-09-19  4:49               ` Po Lu
2022-09-19  6:06                 ` Thierry Volpiatto
2022-09-19  7:24                   ` Po Lu
2022-09-19  8:40                     ` Thierry Volpiatto
2022-09-19  8:52                       ` Po Lu
2022-09-19 17:46                         ` Thierry Volpiatto
2022-09-19 18:05                         ` Thierry Volpiatto
2022-09-19 18:59                           ` Stefan Kangas
2022-09-19 20:16                           ` Tomas Hlavaty
2022-09-19 21:19                             ` Stefan Monnier
2022-09-20  6:16                               ` Thierry Volpiatto
2022-09-20  2:32                             ` Eli Zaretskii
2022-09-20  2:43                               ` Po Lu
2022-09-20  6:25                                 ` Thierry Volpiatto
2022-09-20  8:22                                   ` Po Lu
2022-09-19  7:23                 ` Thierry Volpiatto
2022-09-26 19:42         ` Stefan Kangas
2022-09-26 21:01           ` Stephen Berman
2022-09-26 22:46             ` Stefan Kangas
2022-09-27  7:17               ` Stephen Berman
2022-09-27  7:45                 ` Po Lu
2022-09-27 13:42                   ` Stefan Kangas
2022-09-27  0:33             ` Po Lu
2022-09-27  5:56           ` Eli Zaretskii
2022-09-27  6:13             ` Po Lu
2022-09-27  6:45               ` Eli Zaretskii
2022-09-27  7:50                 ` Po Lu
2022-09-27  7:56                   ` Eli Zaretskii
2022-09-27  8:31                     ` Po Lu
2022-09-27  7:21           ` Thierry Volpiatto [this message]
2022-09-27  7:42             ` Po Lu
2022-09-27  7:55               ` Thierry Volpiatto
2022-09-27  8:35                 ` Po Lu
2022-09-27 18:33                   ` Stefan Kangas
2022-09-28  0:34                     ` Po Lu
2022-09-27 13:57             ` Stefan Kangas
2022-09-27 15:43               ` Visuwesh
2022-09-27 16:19                 ` Stefan Kangas
2022-09-27 16:39                   ` Thierry Volpiatto
2022-09-27 16:40                   ` Eli Zaretskii
2022-09-27 17:01                     ` Stefan Kangas
2022-09-27 17:14                       ` Eli Zaretskii
2022-09-27 18:02                         ` Make format-spec accept a function as the substitution Stefan Kangas
2022-09-29  6:57                           ` Thierry Volpiatto
2022-09-29 12:36                             ` Stefan Monnier
2022-09-29 12:59                               ` Stefan Kangas
2022-09-29 15:02                               ` Philip Kaludercic
2022-09-29 16:34                                 ` Stefan Kangas
2022-09-29 16:53                                   ` Philip Kaludercic
2022-09-29 17:06                                     ` Stefan Kangas
2022-09-29 16:56                                 ` Stefan Monnier
2022-09-29 15:09                               ` Thierry Volpiatto
2022-09-29 16:34                                 ` Stefan Kangas
2022-09-29 14:16             ` master fe7c015b20: Support XFCE in wallpaper.el Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1u51ddf.fsf@posteo.net \
    --to=thievol@posteo.net \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).