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

Add a shared HiDPI Configuration, use it. #157

Closed
wants to merge 3 commits into from

Conversation

pmyjavec
Copy link

@pmyjavec pmyjavec commented May 3, 2020

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.

@Mic92
Copy link
Member

Mic92 commented May 3, 2020

Agreed!

common/pc/display/hidpi.nix Outdated Show resolved Hide resolved
@wmertens
Copy link
Contributor

wmertens commented May 5, 2020

How does this behave when you plug in a FHD display? Xrandr/Wayland will do the right thing?

@utdemir
Copy link
Member

utdemir commented May 12, 2020

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.

Paul Myjavec added 3 commits May 12, 2020 14:21
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.
@pmyjavec
Copy link
Author

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.

How does this behave when you plug in a FHD display? Xrandr/Wayland will do the right thing?

@wmertens , sorry I don't use wayland!

@Mic92
Copy link
Member

Mic92 commented May 12, 2020

cc @colemickens Can you have a look regarding wayland. I also only tested them on Xorg.

@Mic92
Copy link
Member

Mic92 commented May 12, 2020

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.

@pmyjavec
Copy link
Author

pmyjavec commented May 13, 2020

@Mic92 I think that would greatly improve the user experience when first using NixOS! Especially as Retina/HiDPI screens are becoming more prominent.

@matthewbauer
Copy link
Member

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.

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.

@Mic92
Copy link
Member

Mic92 commented May 13, 2020

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.

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.

@Mic92
Copy link
Member

Mic92 commented May 13, 2020

I opened a pull request: NixOS/nixpkgs#87730

@Mic92 Mic92 mentioned this pull request May 13, 2020
10 tasks
@pmyjavec
Copy link
Author

Did we still want this change? Is it just awaiting further testing?

@Mic92
Copy link
Member

Mic92 commented May 23, 2020

I made a new PR here: NixOS/nixpkgs#88669 to include at least the console stuff in a nixos module.

@bbigras
Copy link
Contributor

bbigras commented Jul 25, 2020

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";
Copy link
Member

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.

Comment on lines +2 to +7
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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;

Comment on lines +9 to +10
services.xserver.dpi = lib.mkDefault 196;
fonts.fontconfig.dpi = lib.mkDefault 196;
Copy link
Member

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:

Suggested change
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.

@Mic92
Copy link
Member

Mic92 commented Jul 28, 2020

Actually all improvements could also go to the hidpi module in nixpkgs...

@Mic92
Copy link
Member

Mic92 commented Jul 28, 2020

nixos-generate-config already detects screen sizes and enables the module automatically hence we don't need to include it for every profile.

@Mic92 Mic92 closed this Jul 28, 2020
@pmyjavec
Copy link
Author

@Mic92,

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?

@Mic92
Copy link
Member

Mic92 commented Jul 28, 2020

@pmyjavec What I am saying if you want to improve HiDPI than please contribute to the NixOS module that is now part of nixpkgs. I added most of the stuff except x11 there. I also use some of these options and even documented them in the wiki: https://nixos.wiki/wiki/Xorg However they seem not work for every setup yet.

@pmyjavec
Copy link
Author

@Mic92 ok nice, thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants