alacritty: Inconsistent behavior with DPI scaling

System

OS: Linux Version: alacritty 0.7.1 (a852eb85)

Package versions (X11, DE (lightdm) and WM (bspwm)):

➜ pacman -Qi xorg-server bspwm lightdm | rg -B 1 \^Version
Name            : xorg-server
Version         : 1.20.10-3
--
Name            : bspwm
Version         : 0.9.10-1
--
Name            : lightdm
Version         : 1:1.30.0-4

Description

I have two displays; only one of which is active at any given time. The first “small” display (eDP-1) is the inbuilt 14 inch, 1920x1080 display on my laptop. The second (DP-2) is a 27 inch, 2560x1440 external display (Dell U2721DE). When I connect my laptop to the monitor, I have autorandr perform the following tasks:

  • Turn eDP-1 off, and set DP-2 as the primary
  • Move bspwm desktops to the new display (meaning windows like alacritty get relocated and have more real estate available)
  • Restart a systemd userspace service for polybar, so that the bar is moved to the appropriate display

When disconnecting, the inverse of step one happens.

When Alacritty is spawned on eDP-1, with a font.size of 6, the visual representation of text on screen is satisfactory. When connecting DP-2, no scaling occurs, and the font is still legible at what appears to be the same exact “ratio”. The issue is twofold:

  • When spawning a new Alacritty window on DP-2, scaling occurs and my font.size of 6 results in a font display size that is too small to comfortably read. The text appears smaller than desired, and is in fact a smaller form factor than seen when moving from eDP-1 to DP-2 (the only workflow in which text legibility is visibly satisfactory).
  • With that same (new) window, above, disconnecting from DP-2 (and moving back to eDP-1) does not scale the text to an appropriate size – it appears as if Alacritty thinks my display size and DPI have not changed (this is only fixed by closing Alacritty and reopening on eDP-1). This results in the text being even smaller than it is on DP-2!

My alacritty.yml configuration is fairly light-touch, relying on the default value for many settings, and can be seen here:

https://github.com/sudoforge/dotfiles/blob/trunk/alacritty/.config/alacritty/alacritty.yml

Logs

A fresh window on eDP-1 (text is fine):

20210216T101823855

➜ alacritty -vv
Created log file at "/tmp/Alacritty-50354.log"
[2021-02-15 20:07:24.648747372] [INFO ] [alacritty] Welcome to Alacritty
[2021-02-15 20:07:24.648835236] [INFO ] [alacritty] Configuration files loaded from:
                                                      "/home/sudoforge/.config/alacritty/alacritty.yml"
[2021-02-15 20:07:24.665272784] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:07:24.668672325] [DEBUG] [alacritty] Estimated DPR: 1.6666666666666667
[2021-02-15 20:07:24.668708406] [DEBUG] [alacritty] Estimated window size: None
[2021-02-15 20:07:24.668719878] [DEBUG] [alacritty] Estimated cell size: 8 x 16
[2021-02-15 20:07:24.789380175] [INFO ] [alacritty] Device pixel ratio: 1.6666666666666667
[2021-02-15 20:07:24.800951607] [INFO ] [alacritty] Initializing glyph cache...
[2021-02-15 20:07:24.808727137] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:07:24.821166963] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:07:24.833556581] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:07:24.846224628] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:07:24.872883293] [INFO ] [alacritty] ... finished initializing glyph cache in 0.071869642s
[2021-02-15 20:07:24.873099750] [INFO ] [alacritty] Cell size: 8 x 16
[2021-02-15 20:07:24.873141573] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:07:24.873159137] [INFO ] [alacritty] Width: 800, Height: 600
[2021-02-15 20:07:24.896859713] [INFO ] [alacritty] PTY dimensions: Line(37) x Column(100)
[2021-02-15 20:07:24.903016046] [INFO ] [alacritty] Initialisation complete
[2021-02-15 20:07:24.903745816] [DEBUG] [alacritty_terminal] New num_cols is 240 and num_lines is 66
[2021-02-15 20:07:24.909526337] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:07:24.909586766] [INFO ] [alacritty] Width: 1920, Height: 1056
[2021-02-15 20:07:25.186907601] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:07:26.690592449] [INFO ] [alacritty] Goodbye

Spawned on eDP-1 (text is fine), moved to DP-2 (text doesn’t scale, which is fine):

20210216T101917710

➜ alacritty -vv
Created log file at "/tmp/Alacritty-52745.log"
[2021-02-15 20:09:12.321359760] [INFO ] [alacritty] Welcome to Alacritty
[2021-02-15 20:09:12.321463626] [INFO ] [alacritty] Configuration files loaded from:
                                                      "/home/sudoforge/.config/alacritty/alacritty.yml"
[2021-02-15 20:09:12.347800789] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:09:12.353533015] [DEBUG] [alacritty] Estimated DPR: 1.6666666666666667
[2021-02-15 20:09:12.353599511] [DEBUG] [alacritty] Estimated window size: None
[2021-02-15 20:09:12.353625944] [DEBUG] [alacritty] Estimated cell size: 8 x 16
[2021-02-15 20:09:12.473589906] [INFO ] [alacritty] Device pixel ratio: 1.6666666666666667
[2021-02-15 20:09:12.480261822] [INFO ] [alacritty] Initializing glyph cache...
[2021-02-15 20:09:12.484825584] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:09:12.492180028] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:09:12.499438650] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:09:12.506669969] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:09:12.523237594] [INFO ] [alacritty] ... finished initializing glyph cache in 0.042926714s
[2021-02-15 20:09:12.523348361] [INFO ] [alacritty] Cell size: 8 x 16
[2021-02-15 20:09:12.523365608] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:09:12.523374152] [INFO ] [alacritty] Width: 800, Height: 600
[2021-02-15 20:09:12.541357696] [INFO ] [alacritty] PTY dimensions: Line(37) x Column(100)
[2021-02-15 20:09:12.548591128] [INFO ] [alacritty] Initialisation complete
[2021-02-15 20:09:12.549326381] [DEBUG] [alacritty_terminal] New num_cols is 240 and num_lines is 66
[2021-02-15 20:09:12.554996878] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:09:12.555066389] [INFO ] [alacritty] Width: 1920, Height: 1056
[2021-02-15 20:09:12.830952389] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:09:27.255069141] [DEBUG] [alacritty_terminal] New num_cols is 320 and num_lines is 90
[2021-02-15 20:09:27.263363248] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:09:27.263431035] [INFO ] [alacritty] Width: 2560, Height: 1440
[2021-02-15 20:09:28.325694807] [DEBUG] [alacritty_terminal] New num_cols is 320 and num_lines is 88
[2021-02-15 20:09:28.325786863] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:09:28.325801285] [INFO ] [alacritty] Width: 2560, Height: 1416
[2021-02-15 20:09:34.275462197] [INFO ] [alacritty] Goodbye

A fresh window on DP-2 (text is tiny):

20210216T102534002

➜ alacritty -vv
Created log file at "/tmp/Alacritty-51887.log"
[2021-02-15 20:08:29.516273644] [INFO ] [alacritty] Welcome to Alacritty
[2021-02-15 20:08:29.516325491] [INFO ] [alacritty] Configuration files loaded from:
                                                      "/home/sudoforge/.config/alacritty/alacritty.yml"
[2021-02-15 20:08:29.529019575] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:08:29.531368525] [DEBUG] [alacritty] Estimated DPR: 1.1666666666666667
[2021-02-15 20:08:29.531391934] [DEBUG] [alacritty] Estimated window size: None
[2021-02-15 20:08:29.531401891] [DEBUG] [alacritty] Estimated cell size: 6 x 11
[2021-02-15 20:08:29.588983991] [INFO ] [alacritty] Device pixel ratio: 1.1666666666666667
[2021-02-15 20:08:29.594535904] [INFO ] [alacritty] Initializing glyph cache...
[2021-02-15 20:08:29.598279504] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:08:29.604043873] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:08:29.609243545] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:08:29.614236631] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:08:29.625694761] [INFO ] [alacritty] ... finished initializing glyph cache in 0.031118349s
[2021-02-15 20:08:29.625771390] [INFO ] [alacritty] Cell size: 6 x 11
[2021-02-15 20:08:29.625781416] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:08:29.625788037] [INFO ] [alacritty] Width: 800, Height: 600
[2021-02-15 20:08:29.635551826] [INFO ] [alacritty] PTY dimensions: Line(54) x Column(133)
[2021-02-15 20:08:29.640177715] [INFO ] [alacritty] Initialisation complete
[2021-02-15 20:08:29.640745217] [DEBUG] [alacritty_terminal] New num_cols is 426 and num_lines is 128
[2021-02-15 20:08:29.644439124] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:08:29.644475935] [INFO ] [alacritty] Width: 2560, Height: 1416
[2021-02-15 20:08:29.884879217] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:08:30.781370813] [INFO ] [alacritty] Goodbye

Spawned on DP-2 (text is tiny), moved to eDP-1 (DPR doesn’t appear to change at all, and the text is even smaller!):

20210216T102754727

➜ alacritty -vv
Created log file at "/tmp/Alacritty-54398.log"
[2021-02-15 20:10:51.607034196] [INFO ] [alacritty] Welcome to Alacritty
[2021-02-15 20:10:51.607144478] [INFO ] [alacritty] Configuration files loaded from:
                                                      "/home/sudoforge/.config/alacritty/alacritty.yml"
[2021-02-15 20:10:51.626063465] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:51.628288122] [DEBUG] [alacritty] Estimated DPR: 1.1666666666666667
[2021-02-15 20:10:51.628310168] [DEBUG] [alacritty] Estimated window size: None
[2021-02-15 20:10:51.628317768] [DEBUG] [alacritty] Estimated cell size: 6 x 11
[2021-02-15 20:10:51.682945798] [INFO ] [alacritty] Device pixel ratio: 1.1666666666666667
[2021-02-15 20:10:51.688940374] [INFO ] [alacritty] Initializing glyph cache...
[2021-02-15 20:10:51.691763967] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:51.696870655] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:51.701539832] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:51.706601174] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:51.717385596] [INFO ] [alacritty] ... finished initializing glyph cache in 0.028414513s
[2021-02-15 20:10:51.717472660] [INFO ] [alacritty] Cell size: 6 x 11
[2021-02-15 20:10:51.717482635] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:10:51.717488159] [INFO ] [alacritty] Width: 800, Height: 600
[2021-02-15 20:10:51.738000183] [INFO ] [alacritty] PTY dimensions: Line(54) x Column(133)
[2021-02-15 20:10:51.742927180] [INFO ] [alacritty] Initialisation complete
[2021-02-15 20:10:51.743304558] [DEBUG] [alacritty_terminal] New num_cols is 426 and num_lines is 128
[2021-02-15 20:10:51.746677550] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:10:51.746719548] [INFO ] [alacritty] Width: 2560, Height: 1416
[2021-02-15 20:10:51.989302181] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:55.640415425] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:55.708833309] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:55.745262638] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:55.755399859] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:55.759087630] [INFO ] [alacritty] Font size changed to Size(12) with DPR of 1
[2021-02-15 20:10:55.762804916] [INFO ] [alacritty] Cell size: 5 x 10
[2021-02-15 20:10:55.762862601] [DEBUG] [alacritty_terminal] New num_cols is 438 and num_lines is 121
[2021-02-15 20:10:55.763849418] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:10:55.763890591] [INFO ] [alacritty] Width: 2194, Height: 1214
[2021-02-15 20:10:55.765481490] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT | TARGET_MONO | TARGET_LCD, render_mode: "Lcd", lcd_filter: 1 }
[2021-02-15 20:10:55.793899575] [INFO ] [alacritty] Font size changed to Size(12) with DPR of 1
[2021-02-15 20:10:55.797152791] [INFO ] [alacritty] Cell size: 5 x 10
[2021-02-15 20:10:55.797219678] [DEBUG] [alacritty_terminal] New num_cols is 512 and num_lines is 141
[2021-02-15 20:10:55.807387916] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:10:55.807421941] [INFO ] [alacritty] Width: 2560, Height: 1416
[2021-02-15 20:10:56.291729303] [DEBUG] [alacritty_terminal] New num_cols is 384 and num_lines is 108
[2021-02-15 20:10:56.293293781] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:10:56.293340056] [INFO ] [alacritty] Width: 1920, Height: 1080
[2021-02-15 20:10:56.577642543] [DEBUG] [alacritty_terminal] New num_cols is 384 and num_lines is 105
[2021-02-15 20:10:56.577749058] [INFO ] [alacritty] Padding: 0 x 0
[2021-02-15 20:10:56.577767123] [INFO ] [alacritty] Width: 1920, Height: 1056
[2021-02-15 20:11:07.086535575] [INFO ] [alacritty] Goodbye

Side-by-side screenshots

Adding the screenshots here, again, so that they can easily be viewed and compared without the visual break of the log messages.

Workflow Image
eDP-1 20210216T101823855
eDP1 -> DP-2 20210216T101917710
DP-2 20210216T102534002
DP-2 -> eDP-1 20210216T102754727

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 23 (12 by maintainers)

Most upvoted comments

Here’s a GIF capturing the scaling issue:

DPI Flicker

~There’s a flicker while translating b/w monitors.~

sway 1.9 has a bug with fractional scaling, sway master shouldn’t have it. I’m not sure why they decided to not include a fix, but it’s up to them…

Basically your window should be blurry based on the position on the monitor, when fractional scaling is in use.

Oh, I see where you got that from – this line that was originally in my initial comment:

Linux/BSD: X11/Wayland, DE or Compositor and WM

… is actually from the issue template. I forgot to clean that up when I decided to instead post the package versions in a code block.