Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTK: Respect GNOME Large Text setting (org.gnome.desktop.interface text-scaling-factor) #4338

Closed
mitchellh opened this issue Jan 1, 2025 · 3 comments · Fixed by #4424
Closed
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Milestone

Comments

@mitchellh
Copy link
Contributor

Discussed in #3771

Originally posted by hpfr December 28, 2024
In GNOME Settings, under Accessibility/Seeing, there is a Large Text toggle. Under the hood, this sets org.gnome.desktop.interface text-scaling-factor to 1.25. GTK respects this, so the title bar and context menus look correct, but the terminal emulator text itself does not.

VTE apparently respects this via Pango. For a “native” experience on GNOME, Ghostty probably should too. If Pango isn’t used, reading the key via GSettings might be the way to go.

@mitchellh mitchellh added gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux labels Jan 1, 2025
@hpfr
Copy link
Contributor

hpfr commented Jan 1, 2025

Thanks Mitchell. Recommend browsing the discussion if you want to work on this, I think Pango was a bit of a red herring and GSettings or maybe gtk-xft-dpi is the way to go.

@mitchellh
Copy link
Contributor Author

Also, we can't look at libvte source because it's GPL. So, knowing how they do it conceptually from someone who has looked at it is fine, but actually copying their implementation is not. So anyone working on this must figure this out for themselves (or use MIT-compatible licenses).

@hpfr
Copy link
Contributor

hpfr commented Jan 2, 2025

Turns out reading gtk-xft-dpi was already implemented but gated on X11. #4424 should take care of it.

mitchellh added a commit that referenced this issue Jan 2, 2025
Commit ad503b8 ("linux: consider Xft.dpi to scale the content")
introduced reading gtk-xft-dpi when the X11 build option is enabled.

While the name suggests it is X11-specific (perhaps it was at one
point), gtk-xft-dpi is a GTK setting that can be modified regardless of
GDK backend. GNOME’s Large Text accessibility setting ultimately
modifies it. Outside of desktop environments, it can be set via GTK
configuration files.

Remove the conditional gating the code on X11, since none of the code is
actually X11-specific. While we’re here, document scaling behaviors
under Config.font-size.

Fixes: ad503b8 ("linux: consider Xft.dpi to scale the content")
Fixes: #4338
Link: https://docs.gtk.org/gtk4/class.Settings.html
Link: https://docs.gtk.org/gtk4/property.Settings.gtk-xft-dpi.html
@mitchellh mitchellh added this to the 1.0.2 milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants