unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Re: Re: make-frame-command with multiple munitors
Date: Tue, 20 Sep 2022 11:35:34 +0200	[thread overview]
Message-ID: <CAO48Bk9zMwnJxc8x5YV1_dT9gvEEA+Nt2n1RdSRoEQe3jj-Jjw@mail.gmail.com> (raw)

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

             reply	other threads:[~2022-09-20  9:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  9:35 Pedro Andres Aranda Gutierrez [this message]
2022-09-20 10:14 ` make-frame-command with multiple munitors 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAO48Bk9zMwnJxc8x5YV1_dT9gvEEA+Nt2n1RdSRoEQe3jj-Jjw@mail.gmail.com \
    --to=paaguti@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).