GNU bug report logs - #76691
`display-monitor-attributes-list` not working properly on macOS

Previous Next

Package: emacs;

Reported by: Ruiyang Wu <ywwry66 <at> gmail.com>

Date: Sun, 2 Mar 2025 21:00:03 UTC

Severity: normal

Tags: confirmed, patch

Merged with 76051

Found in versions 29.4, 30.1, 31.0.50

Done: Alan Third <alan <at> idiocy.org>

Full log


View this message in rfc822 format

From: Ship Mints <shipmints <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Ruiyang Wu <ywwry66 <at> gmail.com>, 76691 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#76691: `display-monitor-attributes-list` not working properly on macOS
Date: Mon, 3 Mar 2025 15:05:14 -0500
[Message part 1 (text/plain, inline)]
On Mon, Mar 3, 2025 at 2:58 PM Stefan Kangas <stefankangas <at> gmail.com> wrote:

> found 76691 30.1
> found 76691 31.0.50
> tags 76691 + confirmed
> thanks
>
> Ruiyang Wu <ywwry66 <at> gmail.com> writes:
>
> > I am using the official NS port Emacs 30.1 on a MacBook (macOS Sequoia)
> with an external monitor. The output of `display-monitor-attributes-list`
> is as follows:
> >> (((geometry 0 0 1512 982) (workarea 0 38 1512 944) (mm-size 301 195)
> (frames) (source . "NS")) ((geometry 1512 -517 1600 900 (workarea 1512 -517
> 1600 875) (mm-size 549 311) (frames #<frame scratch* 0x12d08e430>) (source
> . "NS")))
> > It fails to recognize my monitors. Furthermore, when I run `M-x
> make-frame-on-monitor`, no candidate is provided.
> >
> > However, if I use `emacs-mac` from
> https://bitbucket.org/mituharu/emacs-mac/src/master/, the monitors can be
> correctly recognized. `display-monitor-attributes-list` prints
> >> (((geometry 0 0 1512 982) (workarea 0 38 1512 944) (mm-size 301 196)
> (frames) (name . "Built-in Retina Display") (backing-scale-factor . 2))
> ((geometry 1512 -517 1600 900) (workarea 1512 -492 1600 875) (mm-size 549
> 311) (frames #<frame *scratch* - GNU Emacs at Ruiyangs-MBP 0x1400a62c8>)
> (name . "DELL U2515H") (backing-scale-factor . 2)))
> > And I can also use `make-frame-on-monitor` to create new frames without
> issue.
> >
> > Is it possible to have the aforementioned behavior from `emacs-mac` in
> the official NS port? That would greatly improve my workflow. Thank you
> very much!
>
> I can reproduce this on current master, in other words,
>
>     M-x make-frame-on-monitor RET
>
> doesn't provide any completion candidates.
>
> In `make-frame-on-monitor`, I see that this
>
>     (mapcar (lambda (a)
>               (cdr (assq 'name a)))
>             (display-monitor-attributes-list))
>
> produces this on both macOS and GNU/Linux:
>
>     (nil nil)
>
> So I guess this is not specific to the NS port?
>
> Juri, since you added this command, WDYT?
>

On my iMac and laptop, it works.  I have some functions that depend on this
so I know it works.

(display-monitor-attributes-list)
(((geometry 0 0 3200 1800) (workarea 0 25 3200 1775) (mm-size 599 339)
(frames #<frame 30.1 0x7fd3322fbc70> #<frame  0x7fd2f3059610> #<frame
 0x7fd33308a968>) (source . "NS")))
[Message part 2 (text/html, inline)]

This bug report was last modified 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.