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
Add a shared HiDPI Configuration, use it. #157
Conversation
Agreed! |
How does this behave when you plug in a FHD display? Xrandr/Wayland will do the right thing? |
Sorry, this is a bit off topic, but is there a way to check if the display I have is HiDPI? If there is, it might be worth putting it as a comment somewhere. |
Use the common HiDPI configuration with the X1 Extreme, without this X and fonts looked jacked up.
Ensure the change covers all bases, including making the terminal look good on HiDPI displays.
@wmertens , sorry I don't use wayland! |
cc @colemickens Can you have a look regarding wayland. I also only tested them on Xorg. |
I wonder if we should move this module to nixpkgs? We could include it in nixos-generators if we detect a large screen on installation. This way also desktops are covered. |
@Mic92 I think that would greatly improve the user experience when first using NixOS! Especially as Retina/HiDPI screens are becoming more prominent. |
HiDPI isn’t really a property of the machine, but the display. I think it’s probably okay to put it in hardware-configuration.nix for laptops which have a fixed display but Xorg and fontconfig should be able to detect the DPI at runtime. |
They don't adjust at runtime and I don't know why. @lheckemann has added hidpi detection to our configuration generator: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/tools/nixos-generate-config.pl#L501 Even if we don't enable it by default I still see some value if it would be just one import away in NixOS. |
I opened a pull request: NixOS/nixpkgs#87730 |
Did we still want this change? Is it just awaiting further testing? |
I made a new PR here: NixOS/nixpkgs#88669 to include at least the console stuff in a nixos module. |
Now that the PR is merged. What does this PR needs? I can help test on wayland (sway). |
environment.variables = lib.mkDefault { | ||
GDK_SCALE = "2"; | ||
GDK_DPI_SCALE = "0.5"; | ||
_JAVA_OPTIONS = "-Dsun.java2d.uiScale=2"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think those environment variables might brake wayland. We cannot just check if x11
is enabled since wayland will also likely enable x11 for xwayland.
console.font = lib.mkDefault | ||
"${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz"; | ||
|
||
# Needed when doing cryptsetup | ||
console.earlySetup = lib.mkDefault true; | ||
boot.loader.systemd-boot.consoleMode = lib.mkDefault "max"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.font = lib.mkDefault | |
"${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz"; | |
# Needed when doing cryptsetup | |
console.earlySetup = lib.mkDefault true; | |
boot.loader.systemd-boot.consoleMode = lib.mkDefault "max"; | |
hardware.video.hidpi.enable = true; |
services.xserver.dpi = lib.mkDefault 196; | ||
fonts.fontconfig.dpi = lib.mkDefault 196; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I currently:
services.xserver.dpi = lib.mkDefault 196; | |
fonts.fontconfig.dpi = lib.mkDefault 196; | |
services.xserver.displayManager.setupCommands = '' | |
${pkgs.xlibs.xrandr}/bin/xrandr --dpi eDP-1 | |
''; |
It simply sets the dpi of my 4k screen as the dpi of x11. Not sure how to make the eDP-1
part more general.
Actually all improvements could also go to the hidpi module in nixpkgs... |
nixos-generate-config already detects screen sizes and enables the module automatically hence we don't need to include it for every profile. |
Not sure if you read my original comment, but none of this worked for me out of the box, it took me maybe a day or two to actual workout what I needed. Maybe it's better now? |
@pmyjavec What I am saying if you want to improve |
@Mic92 ok nice, thanks for clarifying. |
I've noticed other laptops with HiDPI displays have this configuration set and my laptop didn't, so I thought it might be worth adding a common configuration for basic HiDPI display settings which seem quite universal.