* Frame shifted upwards upon changing font size @ 2022-09-13 4:27 uzibalqa 2022-09-13 11:29 ` Eli Zaretskii 0 siblings, 1 reply; 26+ messages in thread From: uzibalqa @ 2022-09-13 4:27 UTC (permalink / raw) To: uzibalqa via Users list for the GNU Emacs text editor I have a setup that opens emacs at the centre of the screen. But then I want to have a specific font size and call (set-face-attribute 'default nil :height 160 :weight 'bold) This puts the menu-bar outside the screen. What can I do to keep the window at the center of the screen? This is the function I use (defun xframe () "Emacs Startup prior to setting a Development Theme" (typex-inhibit-startup-windows) (set-face-attribute 'default nil :height 160 :weight 'bold) (setq initial-frame-alist '((width . 75) (height . 21)) ) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 4:27 Frame shifted upwards upon changing font size uzibalqa @ 2022-09-13 11:29 ` Eli Zaretskii 2022-09-13 12:10 ` uzibalqa 0 siblings, 1 reply; 26+ messages in thread From: Eli Zaretskii @ 2022-09-13 11:29 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 13 Sep 2022 04:27:17 +0000 > From: uzibalqa <uzibalqa@proton.me> > > > I have a setup that opens emacs at the centre of the screen. > > But then I want to have a specific font size and call > > (set-face-attribute 'default nil :height 160 :weight 'bold) > > This puts the menu-bar outside the screen. What can I do to keep the window at the > center of the screen? I'd try changing default-frame-alist instead of using set-face-attribute. Maybe it will work better. If that doesn't work, change the order between face customizations and setting up the frame coordinates (assuming you do the latter from the init file). In general, what you want is somewhat tricky: Emacs cannot call GUI functions until it has at least one GUI frame, so at best you might see the frame momentarily displayed at the wrong place/with wrong font size before it settles. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 11:29 ` Eli Zaretskii @ 2022-09-13 12:10 ` uzibalqa 2022-09-13 12:25 ` uzibalqa 2022-09-13 12:29 ` Eli Zaretskii 0 siblings, 2 replies; 26+ messages in thread From: uzibalqa @ 2022-09-13 12:10 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs ------- Original Message ------- On Tuesday, September 13th, 2022 at 11:29 AM, Eli Zaretskii <eliz@gnu.org> wrote: > > Date: Tue, 13 Sep 2022 04:27:17 +0000 > > From: uzibalqa uzibalqa@proton.me > > > > I have a setup that opens emacs at the centre of the screen. > > > > But then I want to have a specific font size and call > > > > (set-face-attribute 'default nil :height 160 :weight 'bold) > > > > This puts the menu-bar outside the screen. What can I do to keep the window at the > > center of the screen? > > > I'd try changing default-frame-alist instead of using > set-face-attribute. Maybe it will work better. > > If that doesn't work, change the order between face customizations and > setting up the frame coordinates (assuming you do the latter from the > init file). > > In general, what you want is somewhat tricky: Emacs cannot call GUI > functions until it has at least one GUI frame, so at best you might > see the frame momentarily displayed at the wrong place/with wrong font > size before it settles. default-frame-alist is a confusing as it already has (width . 75) and (height . 21) for the frame. What is the corresponding entry for the font height? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 12:10 ` uzibalqa @ 2022-09-13 12:25 ` uzibalqa 2022-09-13 13:22 ` Gregory Heytings 2022-09-13 12:29 ` Eli Zaretskii 1 sibling, 1 reply; 26+ messages in thread From: uzibalqa @ 2022-09-13 12:25 UTC (permalink / raw) To: uzibalqa; +Cc: Eli Zaretskii, help-gnu-emacs ------- Original Message ------- On Tuesday, September 13th, 2022 at 12:10 PM, uzibalqa <uzibalqa@proton.me> wrote: > ------- Original Message ------- > On Tuesday, September 13th, 2022 at 11:29 AM, Eli Zaretskii eliz@gnu.org wrote: > > > > > > Date: Tue, 13 Sep 2022 04:27:17 +0000 > > > From: uzibalqa uzibalqa@proton.me > > > > > > I have a setup that opens emacs at the centre of the screen. > > > > > > But then I want to have a specific font size and call > > > > > > (set-face-attribute 'default nil :height 160 :weight 'bold) > > > > > > This puts the menu-bar outside the screen. What can I do to keep the window at the > > > center of the screen? > > > > I'd try changing default-frame-alist instead of using > > set-face-attribute. Maybe it will work better. > > > > If that doesn't work, change the order between face customizations and > > setting up the frame coordinates (assuming you do the latter from the > > init file). > > > > In general, what you want is somewhat tricky: Emacs cannot call GUI > > functions until it has at least one GUI frame, so at best you might > > see the frame momentarily displayed at the wrong place/with wrong font > > size before it settles. > > > default-frame-alist is a confusing as it already has (width . 75) and > (height . 21) for the frame. What is the corresponding entry for > the font height? Have found that default-frame-alist much trickier to use. If I set (top . 21) (left . 21) the frame might get placed on a different monitor than from the monitor emacs was called. Have also done a frame-inhibit-implied-resize, this fixes the top-bottom centering but not the left-right centering. Looks as if we need a new function that ensures the frame is centered. (setq initial-frame-alist '((width . 75) (height . 21))) (setq frame-inhibit-implied-resize t) (set-face-attribute 'default nil :height 160 :weight 'bold) (setq frame-inhibit-implied-resize nil) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 12:25 ` uzibalqa @ 2022-09-13 13:22 ` Gregory Heytings 2022-09-13 13:45 ` uzibalqa 0 siblings, 1 reply; 26+ messages in thread From: Gregory Heytings @ 2022-09-13 13:22 UTC (permalink / raw) To: uzibalqa; +Cc: Eli Zaretskii, help-gnu-emacs > > Looks as if we need a new function that ensures the frame is centered. > (defun frame-center (&optional frame display) (interactive) (set-frame-position frame (/ (- (display-pixel-width display) (frame-pixel-width frame)) 2) (/ (- (display-pixel-height display) (frame-pixel-height frame)) 2))) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 13:22 ` Gregory Heytings @ 2022-09-13 13:45 ` uzibalqa 2022-09-13 13:53 ` Gregory Heytings 0 siblings, 1 reply; 26+ messages in thread From: uzibalqa @ 2022-09-13 13:45 UTC (permalink / raw) To: Gregory Heytings; +Cc: Eli Zaretskii, help-gnu-emacs ------- Original Message ------- On Tuesday, September 13th, 2022 at 1:22 PM, Gregory Heytings <gregory@heytings.org> wrote: > > Looks as if we need a new function that ensures the frame is centered. > > > (defun frame-center (&optional frame display) > (interactive) > (set-frame-position > frame > (/ (- (display-pixel-width display) (frame-pixel-width frame)) 2) > (/ (- (display-pixel-height display) (frame-pixel-height frame)) 2))) I have different monitors with different sizes, and the function is transferring the frame to a different monitor. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 13:45 ` uzibalqa @ 2022-09-13 13:53 ` Gregory Heytings 2022-09-13 13:57 ` uzibalqa 0 siblings, 1 reply; 26+ messages in thread From: Gregory Heytings @ 2022-09-13 13:53 UTC (permalink / raw) To: uzibalqa; +Cc: Eli Zaretskii, help-gnu-emacs >> (defun frame-center (&optional frame display) >> (interactive) >> (set-frame-position >> frame >> (/ (- (display-pixel-width display) (frame-pixel-width frame)) 2) >> (/ (- (display-pixel-height display) (frame-pixel-height frame)) 2))) > > I have different monitors with different sizes, and the function is > transferring the frame to a different monitor. > In that case you need to use display-monitor-attributes-list to get the size of the appropriate monitor. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 13:53 ` Gregory Heytings @ 2022-09-13 13:57 ` uzibalqa 2022-09-13 15:28 ` Gregory Heytings 0 siblings, 1 reply; 26+ messages in thread From: uzibalqa @ 2022-09-13 13:57 UTC (permalink / raw) To: Gregory Heytings; +Cc: Eli Zaretskii, help-gnu-emacs Sent with Proton Mail secure email. ------- Original Message ------- On Tuesday, September 13th, 2022 at 1:53 PM, Gregory Heytings <gregory@heytings.org> wrote: > > > (defun frame-center (&optional frame display) > > > (interactive) > > > (set-frame-position > > > frame > > > (/ (- (display-pixel-width display) (frame-pixel-width frame)) 2) > > > (/ (- (display-pixel-height display) (frame-pixel-height frame)) 2))) > > > > I have different monitors with different sizes, and the function is > > transferring the frame to a different monitor. > > > In that case you need to use display-monitor-attributes-list to get the > size of the appropriate monitor. I get (((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size 344 194) (frames #<frame Speedbar 0x415c0c0>) (source . "Gdk")) ((geometry 0 0 1080 1920) (workarea 0 0 1080 1920) (mm-size 477 268) (frames #<frame *scratch* 0x2ca1040>) (source . "Gdk"))) What would be the way forward? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 13:57 ` uzibalqa @ 2022-09-13 15:28 ` Gregory Heytings 2022-09-13 21:07 ` uzibalqa 0 siblings, 1 reply; 26+ messages in thread From: Gregory Heytings @ 2022-09-13 15:28 UTC (permalink / raw) To: uzibalqa; +Cc: Eli Zaretskii, help-gnu-emacs > > I get > > (((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size > 344 194) (frames #<frame Speedbar 0x415c0c0>) (source . "Gdk")) > ((geometry 0 0 1080 1920) (workarea 0 0 1080 1920) (mm-size 477 268) > (frames #<frame *scratch* 0x2ca1040>) (source . "Gdk"))) > > What would be the way forward? > I have a single monitor, so I cannot help you more, sorry, apart from repeating what the docstring says. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 15:28 ` Gregory Heytings @ 2022-09-13 21:07 ` uzibalqa 2022-09-14 10:10 ` Robert Pluim 2022-09-14 10:30 ` Po Lu 0 siblings, 2 replies; 26+ messages in thread From: uzibalqa @ 2022-09-13 21:07 UTC (permalink / raw) To: Gregory Heytings; +Cc: Eli Zaretskii, help-gnu-emacs ------- Original Message ------- On Tuesday, September 13th, 2022 at 3:28 PM, Gregory Heytings <gregory@heytings.org> wrote: > > I get > > > > (((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size > > 344 194) (frames #<frame Speedbar 0x415c0c0>) (source . "Gdk")) > > ((geometry 0 0 1080 1920) (workarea 0 0 1080 1920) (mm-size 477 268) > > (frames #<frame scratch 0x2ca1040>) (source . "Gdk"))) > > > > What would be the way forward? > > > I have a single monitor, so I cannot help you more, sorry, apart from > repeating what the docstring says. Could emacs get to understand the monitor within which the initial frame gets displayed and be able to center the frame in that monitor? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 21:07 ` uzibalqa @ 2022-09-14 10:10 ` Robert Pluim 2022-09-14 15:09 ` uzibalqa 2022-09-14 10:30 ` Po Lu 1 sibling, 1 reply; 26+ messages in thread From: Robert Pluim @ 2022-09-14 10:10 UTC (permalink / raw) To: uzibalqa; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs >>>>> On Tue, 13 Sep 2022 21:07:57 +0000, uzibalqa <uzibalqa@proton.me> said: uzibalqa> ------- Original Message ------- uzibalqa> On Tuesday, September 13th, 2022 at 3:28 PM, Gregory Heytings <gregory@heytings.org> wrote: >> > I get >> > >> > (((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size >> > 344 194) (frames #<frame Speedbar 0x415c0c0>) (source . "Gdk")) >> > ((geometry 0 0 1080 1920) (workarea 0 0 1080 1920) (mm-size 477 268) >> > (frames #<frame scratch 0x2ca1040>) (source . "Gdk"))) >> > >> > What would be the way forward? >> >> >> I have a single monitor, so I cannot help you more, sorry, apart from >> repeating what the docstring says. uzibalqa> Could emacs get to understand the monitor within which the initial frame uzibalqa> gets displayed and be able to center the frame in that monitor? `frame-monitor-attributes' will give you the same information as `display-monitor-attributes-list', but for the monitor where the currently selected frame is displayed. Robert -- ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-14 10:10 ` Robert Pluim @ 2022-09-14 15:09 ` uzibalqa 2022-09-15 7:17 ` Robert Pluim 0 siblings, 1 reply; 26+ messages in thread From: uzibalqa @ 2022-09-14 15:09 UTC (permalink / raw) To: Robert Pluim; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs Sent with Proton Mail secure email. ------- Original Message ------- On Wednesday, September 14th, 2022 at 10:10 AM, Robert Pluim <rpluim@gmail.com> wrote: > > > > > > On Tue, 13 Sep 2022 21:07:57 +0000, uzibalqa uzibalqa@proton.me said: > > > uzibalqa> ------- Original Message ------- > > uzibalqa> On Tuesday, September 13th, 2022 at 3:28 PM, Gregory Heytings gregory@heytings.org wrote: > > > > >> > I get > > >> > > > >> > (((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size > > >> > 344 194) (frames #<frame Speedbar 0x415c0c0>) (source . "Gdk")) > > >> > ((geometry 0 0 1080 1920) (workarea 0 0 1080 1920) (mm-size 477 268) > > >> > (frames #<frame scratch 0x2ca1040>) (source . "Gdk"))) > > >> > > > >> > What would be the way forward? > > >> > > >> > > >> I have a single monitor, so I cannot help you more, sorry, apart from > > >> repeating what the docstring says. > > > uzibalqa> Could emacs get to understand the monitor within which the initial frame > > uzibalqa> gets displayed and be able to center the frame in that monitor? > > > `frame-monitor-attributes' will give you the same information as` display-monitor-attributes-list', but for the monitor where the > currently selected frame is displayed. > > > Robert > -- frame-monitor-attributes gives me ((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size 344 194) (frames #<frame *scratch* 0x1c111f0> #<frame Speedbar 0x30cefc0>) (source . "Gdk")) How do I interpret this, and how can I use this information? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-14 15:09 ` uzibalqa @ 2022-09-15 7:17 ` Robert Pluim 2022-09-15 11:43 ` uzibalqa 0 siblings, 1 reply; 26+ messages in thread From: Robert Pluim @ 2022-09-15 7:17 UTC (permalink / raw) To: uzibalqa; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs >>>>> On Wed, 14 Sep 2022 15:09:55 +0000, uzibalqa <uzibalqa@proton.me> said: uzibalqa> Could emacs get to understand the monitor within which the initial frame >> uzibalqa> gets displayed and be able to center the frame in that monitor? >> >> >> `frame-monitor-attributes' will give you the same information as` >> display-monitor-attributes-list', but for the monitor where the >> currently selected frame is displayed. >> >> >> Robert >> -- uzibalqa> frame-monitor-attributes gives me uzibalqa> ((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size 344 194) uzibalqa> (frames #<frame *scratch* 0x1c111f0> #<frame Speedbar 0x30cefc0>) (source . "Gdk")) uzibalqa> How do I interpret this, and how can I use this information? Well, you do (alist-get 'geometry (frame-monitor-attributes)) which gives you a list, of which the 3rd element is the width of the monitor, which you can use in Gregoryʼs example function. Robert -- ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-15 7:17 ` Robert Pluim @ 2022-09-15 11:43 ` uzibalqa 2022-09-15 12:25 ` Robert Pluim 2022-09-15 15:09 ` Pascal Quesseveur 0 siblings, 2 replies; 26+ messages in thread From: uzibalqa @ 2022-09-15 11:43 UTC (permalink / raw) To: Robert Pluim; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs ------- Original Message ------- On Thursday, September 15th, 2022 at 7:17 AM, Robert Pluim <rpluim@gmail.com> wrote: > > > > > > On Wed, 14 Sep 2022 15:09:55 +0000, uzibalqa uzibalqa@proton.me said: > > > uzibalqa> Could emacs get to understand the monitor within which the initial frame > > >> > > uzibalqa> gets displayed and be able to center the frame in that monitor? > > >> > > >> > > >> `frame-monitor-attributes' will give you the same information as` > > >> display-monitor-attributes-list', but for the monitor where the > > >> currently selected frame is displayed. > > >> > > >> > > >> Robert > > >> -- > > > uzibalqa> frame-monitor-attributes gives me > > > uzibalqa> ((geometry 1080 1152 1366 768) (workarea 1080 1152 1311 768) (mm-size 344 194) > > > uzibalqa> (frames #<frame scratch 0x1c111f0> #<frame Speedbar 0x30cefc0>) (source . "Gdk")) > > > uzibalqa> How do I interpret this, and how can I use this information? > > > Well, you do > > (alist-get 'geometry (frame-monitor-attributes)) > > which gives you a list, of which the 3rd element is the width of > the monitor, which you can use in Gregoryʼs example function. > > Robert > -- Would (frame-position) and the first two elements in (alist-get 'geometry (frame-monitor-attributes)) give me the same information? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-15 11:43 ` uzibalqa @ 2022-09-15 12:25 ` Robert Pluim 2022-09-15 13:38 ` Po Lu 2022-09-15 15:09 ` Pascal Quesseveur 1 sibling, 1 reply; 26+ messages in thread From: Robert Pluim @ 2022-09-15 12:25 UTC (permalink / raw) To: uzibalqa; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs >>>>> On Thu, 15 Sep 2022 11:43:03 +0000, uzibalqa <uzibalqa@proton.me> said: uzibalqa> Would (frame-position) and the first two elements in (alist-get 'geometry (frame-monitor-attributes)) uzibalqa> give me the same information? No. `frame-position' gives you the coordinates of the frame, the other gets you the info for the monitor itself. Robert -- ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-15 12:25 ` Robert Pluim @ 2022-09-15 13:38 ` Po Lu 0 siblings, 0 replies; 26+ messages in thread From: Po Lu @ 2022-09-15 13:38 UTC (permalink / raw) To: Robert Pluim; +Cc: uzibalqa, Gregory Heytings, Eli Zaretskii, help-gnu-emacs Robert Pluim <rpluim@gmail.com> writes: >>>>>> On Thu, 15 Sep 2022 11:43:03 +0000, uzibalqa <uzibalqa@proton.me> said: > > uzibalqa> Would (frame-position) and the first two elements in (alist-get 'geometry (frame-monitor-attributes)) > uzibalqa> give me the same information? > > No. `frame-position' gives you the coordinates of the frame, the other > gets you the info for the monitor itself. If that isn't clear, what Robert is saying is that if frame-position were to return the coordinates of the monitor, then it would appear to originate from the top left corner of the monitor. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-15 11:43 ` uzibalqa 2022-09-15 12:25 ` Robert Pluim @ 2022-09-15 15:09 ` Pascal Quesseveur 2022-09-15 16:07 ` Yuri Khan 1 sibling, 1 reply; 26+ messages in thread From: Pascal Quesseveur @ 2022-09-15 15:09 UTC (permalink / raw) To: help-gnu-emacs FWIW I have defined those functions to position a frame in case of multiple monitors. --8<---------------cut here---------------start------------->8--- (defun qsr/move-frame-pos (frame pos &optional xoffset yoffset) "Move FRAME at POS (x . y) and apply XOFFSET to x coordinate and YOFFSET to y coordinate." (let* ((left (car pos)) (top (cdr pos)) (width (frame-outer-width frame)) (height (frame-outer-height frame)) (monitor-workarea (cdr (assq 'workarea (frame-monitor-attributes frame)))) nleft ntop) (if (and monitor-workarea (< left 0)) (setq nleft (- (+ left width xoffset) (nth 2 monitor-workarea))) (setq nleft (+ left xoffset))) (if (and monitor-workarea (< top 0)) (setq ntop (- (+ top height yoffset) (nth 3 monitor-workarea))) (setq ntop (+ top yoffset))) (set-frame-position frame nleft ntop) frame)) (defun qsr/move-current-frame-offset() "Move selected frame by offset (32 24)." (interactive) (qsr/move-frame-pos (selected-frame) (frame-position) 32 24)) --8<---------------cut here---------------end--------------->8--- HTH -- Pascal Quesseveur pquessev@gmail.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-15 15:09 ` Pascal Quesseveur @ 2022-09-15 16:07 ` Yuri Khan 2022-09-15 16:27 ` Pascal Quesseveur 0 siblings, 1 reply; 26+ messages in thread From: Yuri Khan @ 2022-09-15 16:07 UTC (permalink / raw) To: pquessev; +Cc: help-gnu-emacs On Thu, 15 Sept 2022 at 22:09, Pascal Quesseveur <pquessev@gmail.com> wrote: > > FWIW I have defined those functions to position a frame in case of > multiple monitors. So many workarounds for not using a tiling window manager ;) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-15 16:07 ` Yuri Khan @ 2022-09-15 16:27 ` Pascal Quesseveur 0 siblings, 0 replies; 26+ messages in thread From: Pascal Quesseveur @ 2022-09-15 16:27 UTC (permalink / raw) To: help-gnu-emacs >"YK" == Yuri Khan <yuri.v.khan@gmail.com> writes: YK> So many workarounds for not using a tiling window manager ;) Ahah yes, I'm on Windows. -- Pascal Quesseveur pquessev@gmail.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 21:07 ` uzibalqa 2022-09-14 10:10 ` Robert Pluim @ 2022-09-14 10:30 ` Po Lu 2022-09-14 15:07 ` uzibalqa 2022-09-14 15:21 ` Christopher Dimech 1 sibling, 2 replies; 26+ messages in thread From: Po Lu @ 2022-09-14 10:30 UTC (permalink / raw) To: uzibalqa; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs uzibalqa <uzibalqa@proton.me> writes: > Could emacs get to understand the monitor within which the initial frame > gets displayed and be able to center the frame in that monitor? That gets tricky very quickly. Monitor names are not guaranteed to remain unique, and X-level identifiers are reused in a monotonically increasing fashion and cannot be relied on to uniquely identify the monitor on which where the initial frame was created. In fact, X has 3 kinds of "monitor": CRTCs, outputs, and monitors. A CRT controller defines a rectangle in the screen that has a single mode line, and can have multiple outputs attached. An output is a physical output that displays the contents of its CRTC, and a monitor is a subset of the screen that represents a non-disjoint collection of pixels that will be presented to the user through 1 or more outputs, which may be connected to any number of CRTCs. Of course, a frame might be displayed in multiple overlapping monitors, outputs, and CRT controllers, at any given time. Under such a situation, where do you propose to center the frame? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-14 10:30 ` Po Lu @ 2022-09-14 15:07 ` uzibalqa 2022-09-14 15:21 ` Christopher Dimech 1 sibling, 0 replies; 26+ messages in thread From: uzibalqa @ 2022-09-14 15:07 UTC (permalink / raw) To: Po Lu; +Cc: Gregory Heytings, Eli Zaretskii, help-gnu-emacs ------- Original Message ------- On Wednesday, September 14th, 2022 at 10:30 AM, Po Lu <luangruo@yahoo.com> wrote: > uzibalqa uzibalqa@proton.me writes: > > > Could emacs get to understand the monitor within which the initial frame > > gets displayed and be able to center the frame in that monitor? > > > That gets tricky very quickly. Monitor names are not guaranteed to > remain unique, and X-level identifiers are reused in a monotonically > increasing fashion and cannot be relied on to uniquely identify the > monitor on which where the initial frame was created. > > In fact, X has 3 kinds of "monitor": CRTCs, outputs, and monitors. A > CRT controller defines a rectangle in the screen that has a single mode > line, and can have multiple outputs attached. An output is a physical > output that displays the contents of its CRTC, and a monitor is a subset > of the screen that represents a non-disjoint collection of pixels that > will be presented to the user through 1 or more outputs, which may be > connected to any number of CRTCs. > > Of course, a frame might be displayed in multiple overlapping monitors, > outputs, and CRT controllers, at any given time. > > Under such a situation, where do you propose to center the frame? In the middle of the monitor defined by the location of the mouse pointer, perhaps. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-14 10:30 ` Po Lu 2022-09-14 15:07 ` uzibalqa @ 2022-09-14 15:21 ` Christopher Dimech 1 sibling, 0 replies; 26+ messages in thread From: Christopher Dimech @ 2022-09-14 15:21 UTC (permalink / raw) To: Po Lu; +Cc: uzibalqa, Gregory Heytings, Eli Zaretskii, help-gnu-emacs > Sent: Wednesday, September 14, 2022 at 10:30 PM > From: "Po Lu" <luangruo@yahoo.com> > To: "uzibalqa" <uzibalqa@proton.me> > Cc: "Gregory Heytings" <gregory@heytings.org>, "Eli Zaretskii" <eliz@gnu.org>, help-gnu-emacs@gnu.org > Subject: Re: Frame shifted upwards upon changing font size > > uzibalqa <uzibalqa@proton.me> writes: > > > Could emacs get to understand the monitor within which the initial frame > > gets displayed and be able to center the frame in that monitor? > > That gets tricky very quickly. Monitor names are not guaranteed to > remain unique, and X-level identifiers are reused in a monotonically > increasing fashion and cannot be relied on to uniquely identify the > monitor on which where the initial frame was created. > > In fact, X has 3 kinds of "monitor": CRTCs, outputs, and monitors. A > CRT controller defines a rectangle in the screen that has a single mode > line, and can have multiple outputs attached. An output is a physical > output that displays the contents of its CRTC, and a monitor is a subset > of the screen that represents a non-disjoint collection of pixels that > will be presented to the user through 1 or more outputs, which may be > connected to any number of CRTCs. > > Of course, a frame might be displayed in multiple overlapping monitors, > outputs, and CRT controllers, at any given time. > > Under such a situation, where do you propose to center the frame? Currently a user way cycle through the themes to see how it things. Perhaps there could be something similar for the monitors. Once satisfied the user can pick up a monitor attribute to include include in the init file, if they do not like what emacs decides for them. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 12:10 ` uzibalqa 2022-09-13 12:25 ` uzibalqa @ 2022-09-13 12:29 ` Eli Zaretskii 2022-09-13 12:40 ` uzibalqa 1 sibling, 1 reply; 26+ messages in thread From: Eli Zaretskii @ 2022-09-13 12:29 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 13 Sep 2022 12:10:22 +0000 > From: uzibalqa <uzibalqa@proton.me> > Cc: help-gnu-emacs@gnu.org > > > I'd try changing default-frame-alist instead of using > > set-face-attribute. Maybe it will work better. > > > > If that doesn't work, change the order between face customizations and > > setting up the frame coordinates (assuming you do the latter from the > > init file). > > > > In general, what you want is somewhat tricky: Emacs cannot call GUI > > functions until it has at least one GUI frame, so at best you might > > see the frame momentarily displayed at the wrong place/with wrong font > > size before it settles. > > default-frame-alist is a confusing as it already has (width . 75) and > (height . 21) for the frame. What is the corresponding entry for > the font height? It's 'font' (and use the fully-qualified XLFD name as the value). ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 12:29 ` Eli Zaretskii @ 2022-09-13 12:40 ` uzibalqa 2022-09-13 13:03 ` Eli Zaretskii 0 siblings, 1 reply; 26+ messages in thread From: uzibalqa @ 2022-09-13 12:40 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs ------- Original Message ------- On Tuesday, September 13th, 2022 at 12:29 PM, Eli Zaretskii <eliz@gnu.org> wrote: > > Date: Tue, 13 Sep 2022 12:10:22 +0000 > > From: uzibalqa uzibalqa@proton.me > > Cc: help-gnu-emacs@gnu.org > > > > > I'd try changing default-frame-alist instead of using > > > set-face-attribute. Maybe it will work better. > > > > > > If that doesn't work, change the order between face customizations and > > > setting up the frame coordinates (assuming you do the latter from the > > > init file). > > > > > > In general, what you want is somewhat tricky: Emacs cannot call GUI > > > functions until it has at least one GUI frame, so at best you might > > > see the frame momentarily displayed at the wrong place/with wrong font > > > size before it settles. > > > > default-frame-alist is a confusing as it already has (width . 75) and > > (height . 21) for the frame. What is the corresponding entry for > > the font height? > > > It's 'font' (and use the fully-qualified XLFD name as the value). It is even more difficult for user to identify a font name. set-face-attribute is great because one just specifies its properties without worrying about the actual font (set-face-attribute 'default nil :height 160 :weight 'bold) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 12:40 ` uzibalqa @ 2022-09-13 13:03 ` Eli Zaretskii 2022-09-13 13:15 ` uzibalqa 0 siblings, 1 reply; 26+ messages in thread From: Eli Zaretskii @ 2022-09-13 13:03 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 13 Sep 2022 12:40:38 +0000 > From: uzibalqa <uzibalqa@proton.me> > Cc: help-gnu-emacs@gnu.org > > > > default-frame-alist is a confusing as it already has (width . 75) and > > > (height . 21) for the frame. What is the corresponding entry for > > > the font height? > > > > > > It's 'font' (and use the fully-qualified XLFD name as the value). > > It is even more difficult for user to identify a font name. No, it isn't. Evaluate this in a running Emacs session: (face-font 'default) > set-face-attribute is great because one just specifies its properties > without worrying about the actual font > > (set-face-attribute 'default nil :height 160 :weight 'bold) But you said that it doesn't do the job in this case, and asked for alternatives, right? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Frame shifted upwards upon changing font size 2022-09-13 13:03 ` Eli Zaretskii @ 2022-09-13 13:15 ` uzibalqa 0 siblings, 0 replies; 26+ messages in thread From: uzibalqa @ 2022-09-13 13:15 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs ------- Original Message ------- On Tuesday, September 13th, 2022 at 1:03 PM, Eli Zaretskii <eliz@gnu.org> wrote: > > Date: Tue, 13 Sep 2022 12:40:38 +0000 > > From: uzibalqa uzibalqa@proton.me > > Cc: help-gnu-emacs@gnu.org > > > > > > default-frame-alist is a confusing as it already has (width . 75) and > > > > (height . 21) for the frame. What is the corresponding entry for > > > > the font height? > > > > > > It's 'font' (and use the fully-qualified XLFD name as the value). > > > > It is even more difficult for user to identify a font name. > > > No, it isn't. Evaluate this in a running Emacs session: > > (face-font 'default) > > > set-face-attribute is great because one just specifies its properties > > without worrying about the actual font > > > > (set-face-attribute 'default nil :height 160 :weight 'bold) > > > But you said that it doesn't do the job in this case, and asked for > alternatives, right? Neither does default-frame-alist Seems that a solution would be a function that looks at the monitor size and centers the frame. ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2022-09-15 16:27 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-13 4:27 Frame shifted upwards upon changing font size uzibalqa 2022-09-13 11:29 ` Eli Zaretskii 2022-09-13 12:10 ` uzibalqa 2022-09-13 12:25 ` uzibalqa 2022-09-13 13:22 ` Gregory Heytings 2022-09-13 13:45 ` uzibalqa 2022-09-13 13:53 ` Gregory Heytings 2022-09-13 13:57 ` uzibalqa 2022-09-13 15:28 ` Gregory Heytings 2022-09-13 21:07 ` uzibalqa 2022-09-14 10:10 ` Robert Pluim 2022-09-14 15:09 ` uzibalqa 2022-09-15 7:17 ` Robert Pluim 2022-09-15 11:43 ` uzibalqa 2022-09-15 12:25 ` Robert Pluim 2022-09-15 13:38 ` Po Lu 2022-09-15 15:09 ` Pascal Quesseveur 2022-09-15 16:07 ` Yuri Khan 2022-09-15 16:27 ` Pascal Quesseveur 2022-09-14 10:30 ` Po Lu 2022-09-14 15:07 ` uzibalqa 2022-09-14 15:21 ` Christopher Dimech 2022-09-13 12:29 ` Eli Zaretskii 2022-09-13 12:40 ` uzibalqa 2022-09-13 13:03 ` Eli Zaretskii 2022-09-13 13:15 ` uzibalqa
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.