by lima · 9y ago · 0 comments
Was a wild ride since Skylake + 4k + docking station became stable only recently with Linux 4.9, but scaling always worked.
Here's what it takes:
Xft DPI and hinting settings (font rendering):
# .Xresources
Xft.dpi: 144
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.antialias: 1
Xcursor.size: 48
Xcursor.theme: Adwaita
xrandr DPI setting (important for IntelliJ, i3 and the like): xrandr --dpi 144
Put it into .xinitrc, Gnome autostart, i3 config or wherever your DE runs stuff at session startup. I also run it after resuming since it sometimes resets itself.Now, the most important part - the Gnome scaling settings. Instead of increasing the scaling factor, I leave it at 1x and only increase the text scaling. It's a fractional value and applications still resize appropriately (bonus: reduces the amount of whitespace):
gsettings set org.gnome.desktop.interface text-scaling-factor 1.5
gsettings set org.gnome.desktop.interface scaling-factor 1
Worked well with everything I use (Evolution, virt-manager, LibreOffice, Terminal...).IntelliJ works fine out of the box with java-1.8.0-openjdk. I recommend the Iosevka font, but any font will work.
Latest Chromium respects the settings and support scaling by a fractional value.
When I'm using a low-res screen, I simply render at a high resolution and then scale it down:
xrandr --output eDP-1 --off
xrandr --output DP-2-1 --left-of eDP-1
xrandr --output DP-2-1 --right-of DP-2-2
xrandr --output DP-2-2 --scale 1.5x1.5 --pos 0x0
xrandr --output DP-2-1 --scale 1.5x1.5 --pos 2880x0
While it looks slightly off, you get used to it quickly and I spend most of my workday looking at a downscaled screen without any discomfort.The result is pretty much perfect and comparable (if not better) to macOS with a recent distro. I'm happy to help anyone who is struggling to get this working!
On a more general note, the recent changes in Fedora are amazing! Out-of-box experience went from "a lot worse than Ubuntu" to best-in-class.
I'm impressed you'd call that "pretty much perfect and comparable (if not better) to macOS with a recent distro"
Pretty much sums up why I don't think I'll ever really be ok with a Linux DE for daily usage. If that's what your users consider comparable to macOS why bother aspiring to reach macOS's perfect (seriously, perfect, even when you mirror across a low res screen and a high res screen it lets you use the high res screen at a higher size with perfect scaling) handling of any mix of resolutions.
The 4k screen is at its native resolution. Anything else would be sinful :)
I ran in to a lot of issues doing the xrandr downscaling (my two displays would overlap), so I've just been using Windows partition since this is my gaming PC. My linux partition is Arch, I hope Gnome supports easy fractional scaling soon. Something similar to the display scaling menu on Mac OS would be really nice.
It's probably going to look better with Wayland's per-screen DPI setting, but in the meantime, it's good enough (tm) for me.
Why Linux font rendering exceeds the macOS experience for me: I like the FreeType rendering much better than macOS - less "blurry". Probably comes down to taste. Unless I'm mistaken, macOS scales down for non-integer sizes while Gnome can be configured to render at a fractional value.
Obviously it's much more polished in macOS (otherwise I wouldn't have had to type out the tutorial above), but I'm using Linux for other reasons beyond that and having good font rendering is just a plus - it used to much, much worse.
It also has the same problems with aliasing, blurriness, and artifacts (the blurriness and bad hinting become more pronounced and the artifacts take a back seat)
For one, I have to repeat some of the commands in my script because otherwise I don't end up with the same end result every time. After it's done, for some reason the cursor arrow flickers when it's on the primary display. Sometimes, if I'm unlucky, UI window shadows will draw in the wrong place, and when I'm REALLY unlucky the script crashes X entirely.
Right now I'm hoping that Wayland (or, if I have to, Mir) end up built in a way that makes this kind of configuration stable, intuitive, and sane.