Wayland Qt/GTK dark mode + font rendering

[Posting a thread I wish I found here two days ago]

So, I’m running Niri (so, Wayland), and in a misguided effort to have both GTK and Qt apps to look more or less the same I set gtk.gtk3.theme to breeze-dark and qt.platformTheme to gtk3 in Home Manager. Also a bunch of other settings like home.pointerCursor, gtk.iconTheme, etc.

Cool runnings, except some Qt apps launch in light theme mode, like my music player fooyin. Turns out the correct style name is capitalized in title case – Breeze-Dark (note that gtk.iconTheme still wants breeze-dark though, so you can’t share a single value for those two settings). That fixes the fooyin system theme detection, but now Firefox renders some (but not all???) fonts weird – bold and fuzzy.

This is where my knowledge ends and guessing begins. I guess Firefox picks up GTK theme settings by default, and those somehow affect font rendering? A bit weird, but ok. We can override those though.

# Within Home Manager, but vanilla NixOS also has a `fonts.fontconfig` setting, so you can also instead set it in your `configuration.nix` system-wide.
fonts.fontconfig = {
  enable = true;
  hinting = "slight"; # "none", "slight", "medium", "full"
  subpixelRendering = "rgb"; # "none", "rgb", "bgr", "vertical-rgb", "vertical-bgr"
};

Play around with the hinting to see what’s right for you. And I suspect subpixelRendering might depend on your monitor panel? OLED folks: do some research to see if this is even applicable to you.

1 Like

Been using stylix, which has much of this figured out by now:

2 Likes