emacs-devel
[Top][All Lists]
Advanced

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

Re: make-frame-command with multiple munitors


From: Pedro Andres Aranda Gutierrez
Subject: Re: make-frame-command with multiple munitors
Date: Tue, 20 Sep 2022 16:37:21 +0200

That code works on GNOME and macOS

On Tue, 20 Sept 2022 at 13:07, Po Lu <luangruo@yahoo.com> wrote:
Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> 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 ;-)

What window manager are you using?


--
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


reply via email to

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