How to handle external monitors with different DPI's

I have 2 questions related to external monitors.

I’m running NixOS on my laptop which has a dedicated GPU, an NVIDIA GeForce GTX 1660 Ti. And for CPU an Intel i7-9750H. At home it’s almost always connected to 2 external 1440p 27 inch monitors. I installed the NVIDIA drivers according to the wiki page. With the drivers installed all windows look blown up and blurry. Without the drivers it’s fine.

I’ve tried using nvidia-settings and noticed it’s using 1 screen in which all 3 monitors are setup and they share a DPI of 109. I’ve calculated the DPI as 141 for my laptop monitor and 109 for each external monitor. But whatever I change here it doesn’t get saved and/or applied.

So I tried using xrandr (see below), xlayoutdisplay and even xrandr-extend to set it up manually. I also played around with scaling, but that increases the blurryness.

xrandr \
--output DP-2 --mode 1920x1080 --pos 0x0 --rotate normal \
--output DP-0 --mode 2560x1440 --right-of DP-2 --rotate normal --primary \
--output HDMI-0 --mode 2560x1440 --right-of DP-0 --rotate normal --dpi 109

Just FYI, here is the xrandr --query output:

Screen 0: minimum 8 x 8, current 7040 x 1440, maximum 32767 x 32767
DP-0 connected primary 2560x1440+1920+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+  74.97  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1440     59.91  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 2560x1440+4480+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+  74.97  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1440     59.91  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1920x1080    144.00*+
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)

What am I missing here? How do I set this up correctly?


In general I’m a bit confused as to how I should handle external monitors. I sometimes connect random monitors at work, friends or family. As a former Windows user I never had to think about resolution or DPI. I can’t imagine I have to configure a new monitor every time I connect to a new monitor. I’ve read multiple comments on random places that “you should not expect to connect a monitor and it will just work”, but that is exactly what I would expect.

Can someone please enlighten me?

Edit: I just realised this might not have anything to do with NixOS itself. My apologies for this post in that case. Still trying to get adjusted.

I solved it by enabling Force font DPI in Settings > Appearance > Fonts. It defaults to 96 DPI and for some reason it fixed everything. Not sure how this works yet, but I’m quite happy I can finally use my monitors properly.

So I was almost there. NixOS runs the command I mentioned earlier but with 96 DPI and all is okay.

xrandr \
--output DP-2 --mode 1920x1080 --pos 0x0 --rotate normal \
--output DP-0 --mode 2560x1440 --pos 1920x0 --rotate normal --primary \
--output HDMI-0 --mode 2560x1440 --pos 4480x0 --rotate normal --dpi 96