all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* make-frame-command with multiple munitors
@ 2022-09-15 15:15 Pascal Quesseveur
  2022-09-17 17:55 ` Juri Linkov
  0 siblings, 1 reply; 23+ messages in thread
From: Pascal Quesseveur @ 2022-09-15 15:15 UTC (permalink / raw)
  To: emacs-devel

Hello,

When I work with several monitors I would like that when, in a frame,
I run a command which opens a new frame, this frame is created on the
same monitor as that of the current frame, which is not always the
case.

Function make-frame-on-current-monitor exists to meet this use case
but it is not really easy to use interactively. Variable
pop-up-frame-function can be set to use a function different from
make-frame for creating a new frame in display-buffer-pop-up-frame.

I have used pop-up-frame-function to use make-frame-on-current-monitor
instead of make-frame. That works fine but there is no easy way to do
the same with special-display-popup-frame or make-frame-command.

IMHO it would be worth to use such a variable in those functions too.


-- 
Pascal Quesseveur
pquessev@gmail.com




^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: Re: Re: make-frame-command with multiple munitors
@ 2022-09-20  9:35 Pedro Andres Aranda Gutierrez
  2022-09-20 10:14 ` Emanuel Berg
  2022-09-20 11:07 ` Po Lu
  0 siblings, 2 replies; 23+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-09-20  9:35 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

Christopher Dimech <dimech@gmx.com> writes:

> Emacs has the capability of placing a frame at some position.  It is then
> logical for emacs to look into the monitor configuration to determine the
> current monitor (then placing at corners or center oy monitor).  It would
> a feature very much appreciated if made to happen.

+1. I'm doing it on my own with:

(defun reposition-after-init ()
  "Re-position the frame in a display (Only for emacs 29 and above)"
  (when (> emacs-major-version 28)
    (let* ((monitor-attributes (frame-monitor-attributes))
           (work-area (assq 'workarea monitor-attributes))
           (x-min (nth 1 work-area))
           (y-min (nth 2 work-area))
           (new-x  (+ x-min 32))
           (new-y  (+ y-min 32)))
      (message "work-area: %s -> %d %d" work-area new-x new-y)
      (set-frame-position (selected-frame) new-x new-y))))

Hooked to the startup in

(add-hook #'after-init-hook #'reposition-after-init)

This works when you do NOT specify (left or top) in the default-frame-alist
or initial-frame-alist

It would be nice to have a (current-monitor . t) in the default-frame-alist
or initial-frame-alist to do this ;-)

//PA

PS: tested on X and mac
-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2179 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-09-21 11:44 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-15 15:15 make-frame-command with multiple munitors Pascal Quesseveur
2022-09-17 17:55 ` Juri Linkov
2022-09-17 18:37   ` wilnerthomas--- via Emacs development discussions.
2022-09-19  7:21   ` Pascal Quesseveur
2022-09-19 12:28     ` Po Lu
2022-09-19 13:21       ` Christopher Dimech
2022-09-19 13:38         ` Po Lu
2022-09-19 14:54           ` Christopher Dimech
2022-09-19 17:58       ` Pascal Quesseveur
2022-09-19 19:22         ` Juri Linkov
2022-09-20  6:57           ` Juri Linkov
2022-09-19 20:16         ` Christopher Dimech
  -- strict thread matches above, loose matches on Subject: below --
2022-09-20  9:35 Re: " Pedro Andres Aranda Gutierrez
2022-09-20 10:14 ` Emanuel Berg
2022-09-20 11:07 ` Po Lu
2022-09-20 14:37   ` Pedro Andres Aranda Gutierrez
2022-09-21  2:15     ` Po Lu
2022-09-21  5:08       ` Pedro Andres Aranda Gutierrez
2022-09-21  5:22         ` Pedro Andres Aranda Gutierrez
2022-09-21  5:44           ` Po Lu
2022-09-21  9:21             ` Pedro Andres Aranda Gutierrez
2022-09-21 10:52               ` Po Lu
2022-09-21 10:55                 ` Pedro Andres Aranda Gutierrez
2022-09-21 11:44                   ` Po Lu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.