From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pedro Andres Aranda Gutierrez Newsgroups: gmane.emacs.devel Subject: Re: make-frame-command with multiple munitors Date: Tue, 20 Sep 2022 16:37:21 +0200 Message-ID: References: <875yhil2xw.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009da53205e91cc58a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33791"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 20 20:23:12 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oahto-0008XU-5W for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Sep 2022 20:23:12 +0200 Original-Received: from localhost ([::1]:56158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oahtm-0003Nd-Mr for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Sep 2022 14:23:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaeNi-0005GM-Kg for emacs-devel@gnu.org; Tue, 20 Sep 2022 10:37:51 -0400 Original-Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:36595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oaeNg-0007q1-Qz for emacs-devel@gnu.org; Tue, 20 Sep 2022 10:37:50 -0400 Original-Received: by mail-ej1-x636.google.com with SMTP id 13so6708623ejn.3 for ; Tue, 20 Sep 2022 07:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=zwHym/qdRMGc5F4Y+7arYoILnQGRxLAIFTogOzo467U=; b=HII9rBcbvoVmZiX8U394DOiHcWGlRMcmWZr3KAkInG+tOqMvAteSHUjDj0BGbc8rzX 2YKDOVqO2rGXf+8uWCbGqqp1NqpfQGoEsgTl3hMev5iQord65Rn9SOiOU9PXLh84nxMb cMBPVqXlEcP3ftrwnoluqvi4znjhD56Izqmu53u+dFBpdtoF3UnAQEXYT56Djr6jL/v/ xJII1rrrg45x4SDAg1SR5AmOqNNe/OKM/L+zUcFKTyHp4rVOltCpNIkG+1mKwBevTA+Q 5bRUH9Uv0FZAYP+KgTzHCZxtiKcUSctOpV35oclpxnSDwrY9T/0teAWlZn1DZ0jpGGRC ZEgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=zwHym/qdRMGc5F4Y+7arYoILnQGRxLAIFTogOzo467U=; b=NoH0P0Cm4k0XUwjPiT2BaUvoxRXaxNp0SYyiEIGpuBdJXM5Yiiq5ZFhk6pzVedm896 C7UOfHp8k0Jm/PZc7RdzpGrefhjXbvq6Mr9hzNelXdhXZ9wXORXTzFpA6fcNSbo92X+0 X2+W1PM0D10z5AgvQU73PFuHSjYEraZGdao433QsAPFC6UP7Z1QWQHPrH7cTjxx32Zm0 cCbMgjoTLoaZ9LU0LPxBaLYKJ2kC5W1DTSRawOVux/a+YnQQa34PasLRAiDcb5uBRiK5 3xMJP1U0WfI2mQ1ZXge/WKgYkSis7e5JL85mroFg5IGUbHrRVCnV0rg/9fIGOo3goMt1 jNKg== X-Gm-Message-State: ACrzQf3LBnREEUyiw0tXPrfi6lx3ReTi/cPpzdE8L7at+qtrnj8DJtRc HQDmicRbwgGjrEYY8E/Q5+lC2hsorPUieiNfPUo= X-Google-Smtp-Source: AMsMyM5QidD5ql4ff/78n8rfWBVwMIK9Mu0QQ+2n8WSiSxedOObTKmBai2C/bW6Qt6CkQX9PUIlHEoZejeZvDC0wkDI= X-Received: by 2002:a17:907:a421:b0:780:c72d:daa with SMTP id sg33-20020a170907a42100b00780c72d0daamr13833054ejc.68.1663684667350; Tue, 20 Sep 2022 07:37:47 -0700 (PDT) In-Reply-To: <875yhil2xw.fsf@yahoo.com> Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=paaguti@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295824 Archived-At: --0000000000009da53205e91cc58a Content-Type: text/plain; charset="UTF-8" That code works on GNOME and macOS On Tue, 20 Sept 2022 at 13:07, Po Lu wrote: > Pedro Andres Aranda Gutierrez writes: > > > Christopher Dimech 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 --0000000000009da53205e91cc58a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
That code works on GNOME and macOS

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

> Christopher Dimech <dimech@gmx.com> writes:
>
>> Emacs has the capability of placing a frame at some position.=C2= =A0 It is then
>> logical for emacs to look into the monitor configuration to determ= ine the
>> current monitor (then placing at corners or center oy monitor).=C2= =A0 It would
>> a feature very much appreciated if made to happen.
>
> +1. I'm doing it on my own with:
> (defun reposition-after-init ()
>=C2=A0 =C2=A0"Re-position the frame in a display (Only for emacs 2= 9 and above)"
>=C2=A0 =C2=A0(when (> emacs-major-version 28)
>=C2=A0 =C2=A0 =C2=A0(let* ((monitor-attributes (frame-monitor-attribute= s))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (work-area (assq 'workare= a monitor-attributes))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (x-min (nth 1 work-area))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (y-min (nth 2 work-area))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (new-x=C2=A0 (+ x-min 32)) >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (new-y=C2=A0 (+ y-min 32))) >=C2=A0 =C2=A0 =C2=A0 =C2=A0(message "work-area: %s -> %d %d&quo= t; work-area new-x new-y)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(set-frame-position (selected-frame) new-x n= ew-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

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

--0000000000009da53205e91cc58a--