Function: frame-monitor-attribute
frame-monitor-attribute is a byte-compiled function defined in
frame.el.gz.
Signature
(frame-monitor-attribute ATTRIBUTE &optional FRAME X Y)
Documentation
Return the value of ATTRIBUTE on FRAME's monitor.
If FRAME is omitted or nil, use currently selected frame.
By default, the current monitor is the physical monitor dominating the selected frame. A frame is dominated by a physical monitor when either the largest area of the frame resides in the monitor, or the monitor is the closest to the frame if the frame does not intersect any physical monitors.
If X and Y are both numbers, then ignore the value of FRAME; the monitor is determined to be the physical monitor that contains the pixel coordinate (X, Y).
See display-monitor-attributes-list for the list of attribute
keys and their meanings.
Source Code
;; Defined in /usr/src/emacs/lisp/frame.el.gz
(defun frame-monitor-attribute (attribute &optional frame x y)
"Return the value of ATTRIBUTE on FRAME's monitor.
If FRAME is omitted or nil, use currently selected frame.
By default, the current monitor is the physical monitor
dominating the selected frame. A frame is dominated by a
physical monitor when either the largest area of the frame
resides in the monitor, or the monitor is the closest to the
frame if the frame does not intersect any physical monitors.
If X and Y are both numbers, then ignore the value of FRAME; the
monitor is determined to be the physical monitor that contains
the pixel coordinate (X, Y).
See `display-monitor-attributes-list' for the list of attribute
keys and their meanings."
(if (and (numberp x)
(numberp y))
(cl-loop for monitor in (display-monitor-attributes-list)
for geometry = (alist-get 'geometry monitor)
for min-x = (pop geometry)
for min-y = (pop geometry)
for max-x = (+ min-x (pop geometry))
for max-y = (+ min-y (car geometry))
when (and (<= min-x x)
(< x max-x)
(<= min-y y)
(< y max-y))
return (alist-get attribute monitor))
(alist-get attribute (frame-monitor-attributes frame))))