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: Po Lu
Subject: Re: make-frame-command with multiple munitors
Date: Tue, 20 Sep 2022 19:07:07 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

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?


reply via email to

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