-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Streamline DPI settings #25892
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
Streamline DPI settings #25892
Conversation
I don't think it's meaningful to have multiple DPI settings. Perhaps have just one nixos option and change the rest into alias names. |
Pushed fixed version -- I cherry-picked from the wrong branch, sorry. @vcunat My thoughts too. There are also other usecases for DPI value (for example perhaps console fonts). IMHO more generic name of those two is |
Hmm, choosing the default console font depending on DPI... that would be possible, maybe even not too magical. |
@vcunat I expect something like:
BTW while reading docs on I'm still going deeper in the rabbit hole of Linux DPI settings and want to write up a small overview when finished... |
So, to sum up what I found out: There are three distinct sources of DPI information on Linux: fontconfig, Xresources (
There are many other places I haven't examined; for example setting DPI in Also notice that we already set Overall it seems to me that we should promote usage of Xrandr/Xresources with this:
cc @rbasso as one who may be knowledgeable about DPI -- maybe you have something to add/correct? |
Also cc @ttuegel as the current fontconfig person :D |
Ouch! We should drop |
@ttuegel Yeah, after more thought I think we should just merge them (but also recommend people to set proper DPI for their monitors instead and not use that option). I'll prepare the patch a bit later. |
b9e718a
to
c724830
Compare
I've pushed the second version of the patchset which implements what we've outlined above:
|
So, any comments on this? I'm not completely sure all changes are a good idea. |
I like all the changes — just one thing to add, which is that I think the X resources should be loaded before user sessions to make sure that they apply to the display manager too. I'm not sure if there's a way to do that in one place for all the display managers, considering that (AFAIU) it's the display manager's responsibility to start the X server. |
@lheckemann Actually I wanted to do it this very way but I don't know if it's even possible :D IIUC this would require some kind of support in a display manager. |
I suppose that's just another reason not to recommend the setting, preferring instead Monitor sections. I approve of the changes overall, for what my opinion's worth :) |
Hm, actually we need to test that DPI works properly with display managers. It should be, but still... I'll do this tomorrow if noone beats me. |
I can't speak for other display managers, but SDDM allows to specify a script to setup the X server. At the moment, I think we use the default script shipped by upstream, but we could easily change that. I don't know what other display managers do, but I expect something similar because each distribution has different requirements for starting the server.
Is there a way to set individual Monitor sections in NixOS? I was not aware of this. If that is so, I would strongly recommend doing that instead of overriding DPI for the whole server. From the perspective of font rendering, using a DPI that does not match the display is likely to produce really horrible results. |
Between services.xserver.monitorSection and services.xserver.config, it is indeed possible to specify arbitrary Monitor sections. |
Argh, sorry, life got into the way and I delayed this greatly. DPI and monitor sections seem to work with display managers. As for X resources -- can we somehow load them in our X wrapper? I haven't immediately found a way to do that. |
*bump* AFAICT, we don't have an X wrapper. I think that it would be nice to get this change merged, even if it doesn't affect the display manager in all cases yet. |
This will need a release-notes update for the NixOS revision it lands into. If done quickly, and there are no objections, this could land in 18.09 I imagine. If I understand this correctly; part of the PR is already included in master since November 2017, we're left with the removal of the font-specific DPI hacks, right? If so, I (personally) think this can be merged 👍 (once release notes written, or arrangements to write them are made). |
Any updates on this pull request, please? |
Ah, completely forgot about this one. I'll do a writeup for the release notes and then it should be ready. |
@abbradar Could you please rebase your PR and add an entry to the next release notes https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2003.xml ? |
@abbradar Ping? |
I marked this as stale due to inactivity. → More info |
This is a good old PR I forgot about and found. Rebased and added release notes. |
@Ericson2314 there was a conflict in the release notes. Inserting in a random place mitigates those, fwiw. |
37f17a2
to
cc8453b
Compare
OK, let the merge conflict guide me to that random spot :D |
Recommend to use services.xserver.dpi option instead. Mention in the documentation that it's a sledgehammer approach and monitor settings should be used instead. Also don't set DPI in fontconfig settings; fontconfig should use Xft settings by default so let's not override one value in multiple places. For example, user now can set DPI via ~/.Xresources properly.
cc8453b
to
bd18e49
Compare
I just updated from 21.05 and found that Meanwhile, I also have |
The fonts.fontconfig.dpi option was removed, which caused alacritty to display a huge font size. Add this setting back into Xresources. There may be more to doing this properly, but this works for now. NixOS/nixpkgs#25892 alacritty/alacritty#1339
The fonts.fontconfig.dpi option was removed, which caused alacritty to display a huge font size. Add this setting back into Xresources. There may be more to doing this properly, but this works for now. NixOS/nixpkgs#25892 alacritty/alacritty#1339
Motivation for this change
Currently we use it to set default X fonts DPI equal to screen DPI. It's needed
to make GTK3 use system DPI: #25023.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)Several questions that arise because of this patch:
fonts.fontconfig.dpi
andservices.xserver.dpi
options. Are there any cases where they can differ? Maybe we want to drop one of them to make this uniform?/etc/X11/Xresources
.