Function: wallpaper--x-monitor-name
wallpaper--x-monitor-name is a byte-compiled function defined in
wallpaper.el.gz.
Signature
(wallpaper--x-monitor-name)
Documentation
Get the monitor name for wallpaper-set.
On a graphical display, try using the same monitor as the current frame. On a non-graphical display, try to get the name by connecting to the display server directly, or run "xrandr" if that doesn't work. Prompt for the monitor name if neither method works.
This function is meaningful only on X and is used only there.
Source Code
;; Defined in /usr/src/emacs/lisp/image/wallpaper.el.gz
;;; wallpaper-set
(defun wallpaper--x-monitor-name ()
"Get the monitor name for `wallpaper-set'.
On a graphical display, try using the same monitor as the current
frame.
On a non-graphical display, try to get the name by connecting to
the display server directly, or run \"xrandr\" if that doesn't
work. Prompt for the monitor name if neither method works.
This function is meaningful only on X and is used only there."
(if (or (display-graphic-p)
noninteractive)
(let-alist (car (display-monitor-attributes-list))
(if (and .name (member .source '("XRandr" "XRandR 1.5" "Gdk")))
.name
"0"))
(if-let ((name
(and (getenv "DISPLAY")
(or
(cdr (assq 'name
(progn
(x-open-connection (getenv "DISPLAY"))
(car (display-monitor-attributes-list
(car (last (terminal-list))))))))
(and (executable-find "xrandr")
(with-temp-buffer
(call-process "xrandr" nil t nil)
(goto-char (point-min))
(re-search-forward (rx bol
(group (+ (not (in " \n"))))
" connected")
nil t)
(match-string 1)))))))
;; Prefer "0" to "default" as that works in XFCE.
(if (equal name "default") "0" name)
(read-string (format-prompt "Monitor name" nil)))))