Function: wallpaper--format-arg

wallpaper--format-arg is a byte-compiled function defined in wallpaper.el.gz.

Signature

(wallpaper--format-arg FORMAT FILE)

Documentation

Format a wallpaper-command-args argument ARG using FORMAT.

FILE is the image file name.

Source Code

;; Defined in /usr/src/emacs/lisp/image/wallpaper.el.gz
(defun wallpaper--format-arg (format file)
  "Format a `wallpaper-command-args' argument ARG using FORMAT.
FILE is the image file name."
  (format-spec
   format
   `((?f . ,(expand-file-name file))
     (?F . ,(lambda ()
              (mapconcat #'url-hexify-string
                         (file-name-split file)
                         "/")))
     (?h . ,(lambda ()
              (wallpaper--get-height-or-width
               "height"
               #'display-pixel-height
               wallpaper-default-height)))
     (?w . ,(lambda ()
              (wallpaper--get-height-or-width
               "width"
               #'display-pixel-width
               wallpaper-default-width)))
     ;; screen number
     (?S . ,(lambda ()
              (let ((display (frame-parameter (selected-frame) 'display)))
                (if (and display
                         (string-match (rx ":" (+ (in "0-9")) "."
                                           (group (+ (in "0-9"))) eos)
                                       display))
                    (match-string 1 display)
                  "0"))))
     ;; monitor name
     (?M . ,#'wallpaper--x-monitor-name)
     ;; workspace
     (?W . ,(lambda ()
              (or (and (fboundp 'x-window-property)
                       (display-graphic-p)
                       (number-to-string
                        (or (x-window-property "_NET_CURRENT_DESKTOP" nil "CARDINAL" 0 nil t)
                            (x-window-property "WIN_WORKSPACE" nil "CARDINAL" 0 nil t)
                            0)))
                  "0"))))))