[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30074: 26.0; Add function(s) for current monitor info

From: Juri Linkov
Subject: bug#30074: 26.0; Add function(s) for current monitor info
Date: Sun, 14 Jul 2019 22:49:23 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> Please consider adding a function that returns the info describing the
>> monitor that dominates a frame (default: selected frame).  In
>> particular, the size of the monitor.  This can be useful, for example,
>> for positioning a frame when there are multiple monitors.
>> I've been using this, but you might have a better implementation in
>> mind:
>> (defun current-monitor (&optional frame)
>>   "Attributes of monitor that dominates FRAME (default: `selected-frame')."
>>   (catch 'current-monitor
>>     (dolist (atts  (display-monitor-attributes-list frame))
>>       (when (member (or frame  (selected-frame)) (cdr (assq 'frames atts)))
>>         (throw 'current-monitor atts)))
>>     nil))                              ; Should never happen (?)
> I guess it's possible for a frame to be on several monitors?  (Half on
> one and half on another.)  What would this function return in that case?

There is already `frame-monitor-attributes' added in Emacs 24 (see NEWS.24),

  (frame-monitor-attributes (selected-frame))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]