all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: "Perry E. Metzger" <perry@piermont.com>
Cc: emacs-devel@gnu.org
Subject: Re: Is there a way to control where frames get created?
Date: Sun, 30 Sep 2018 13:58:48 +0200	[thread overview]
Message-ID: <87murzb3if.fsf@web.de> (raw)
In-Reply-To: <20180929183701.0b49b97d@jabberwock.cb.piermont.com> (Perry E. Metzger's message of "Sat, 29 Sep 2018 18:37:01 -0400")

"Perry E. Metzger" <perry@piermont.com> writes:

> I'd like to rig things up so that make-frame-command creates its new
> frame adjacent to the existing frame if that's geometrically
> possible on the GUI display. To do that, I'd need to both be able to
> find out where the existing frame is, and to tell make-frame-command
> where to create the new frame.

I want something similar if I understand you correctly: I want that all
frames appear slightly shifted horizontally.  I use
'after-make-frame-functions' to implement this:

#+begin_src emacs-lisp
(require 'cl-lib)

(defun my-reposition-frame-after-create (frame)
  (when window-system
    (if  (> (frame-pixel-width frame) (display-pixel-width))
        (set-frame-parameter nil 'fullscreen 'maximized)
      (let* ((frames (delq frame (filtered-frame-list (lambda (f) (eq t (frame-visible-p f))))))
             (xs (cl-remove-if (lambda (val) (not (integerp val)))
                               (mapcar (lambda (f) (frame-parameter f 'left)) frames)))
             (new-x 0))
        (while (member new-x xs)
          (cl-incf new-x 20))
        (set-frame-parameter frame 'left new-x)
        (set-frame-parameter frame 'user-position t)))))

(add-hook 'after-make-frame-functions #'my-reposition-frame-after-create)
#+end_src

It's a hack but got enough for me.  I have some more related stuff,
e.g. to reorder frames to fill the gap of a deleted frame.


Michael.



      parent reply	other threads:[~2018-09-30 11:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-29 22:37 Is there a way to control where frames get created? Perry E. Metzger
2018-09-30  1:37 ` Drew Adams
2018-09-30  7:57 ` martin rudalics
2018-09-30 12:05   ` Perry E. Metzger
2018-09-30 12:22     ` martin rudalics
2018-09-30 14:14   ` Perry E. Metzger
2018-09-30 14:41     ` Perry E. Metzger
2018-09-30 16:20       ` Stefan Monnier
2018-09-30 17:48         ` martin rudalics
2018-09-30 18:07           ` Perry E. Metzger
2018-09-30 17:47       ` martin rudalics
2018-09-30 18:35         ` Perry E. Metzger
2018-10-01  8:35           ` martin rudalics
2018-10-01 11:06             ` Perry E. Metzger
2018-10-01 15:06               ` martin rudalics
2018-09-30 11:58 ` Michael Heerdegen [this message]

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

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

  git send-email \
    --in-reply-to=87murzb3if.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=emacs-devel@gnu.org \
    --cc=perry@piermont.com \
    /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 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.