4

I am running KUbuntu 20.04 and changed my default fonts there. The KDE system settings GUI has a button to configure GTK appearance, but this only allows changing the whole theme to another predefined theme.

I found two CLI utilities, gtk-chtheme and gtk-theme-switch2. One of them (I don't get which one) helped me apply the change to GTK2 apps.

But I am still stuck when it comes to GTK3 apps (the majority !).

I understand GTK switched from so-called RC files to their own flavour of CSS, but most information I can find seems directed at people creating whole new themes, which is way too complicated and overkill for me.

It does not help that search results (including here) are plagued with ultra old questions.

I am also intrigued by where Thunderbird gets it default fonts (Tinos, Arimo, Cousine) from, but that may be another question (or maybe not !).

3 Answers 3

2

Thanks to @ysalmon's answer, which gave me a head start on figuring this out.

I was able to make it work just by adding a gtk-font-name=DejaVu, 14 line to my ~/.config/gtk-3.0/settings.ini file. If this file doesn't already exist, you need to create it with a [Settings] group:

[Settings]
gtk-font-name=DejaVu, 14

I found that leaving off the font name ("DejaVu") will set the font size without changing the font family. My configuration is perhaps not representative, though. I'm running on an Ubuntu VM within the Windows Subsystem for Linux, so I am not running either the Gnome or KDE UI shell. There may be other things needed for stand-alone setups.

1

Here is what I did to get my Noto Sans Condensed setting to apply to GTK3 apps.

I do not know if the first part is necessary since it worked for some programs (eg. Meld, dconf-editor) but not others (eg. Firefox, Thunderbird). Create or add to ~/.config/font-manager/local.conf :

<match target="pattern">
   <test qual="any" name="family"><string>sans-serif</string></test>
   <edit name="family" mode="assign" binding="same"><string>Noto Sans Condensed</string></edit>
</match>

Second part ; I do not know which steps are really necessary or if they are redundant :

  • update ~/.config/xsettingsd/xsettingsd.conf with Gtk/FontName "Noto Sans Condensed, 11"
  • update ~/.config/gtk-3.0/settings.ini with gtk-font-name=Noto Sans Condensed, 11
  • in dconf, under org.gnome.desktop.interface, set font-name to 'Noto Sans Condensed, 11'.

Third part is taking into account that KDE's Plasma GTKd will erase the changes made in part two at login. I do not know if this is a misconfiguration on my part or a bug (KDE refers to the font as "Noto Sans" with the "Condensed" attribute while in GTK one needs to have "Noto Sans Condensed" as the font name ; maybe the setting transfer is buggy). So I just deactivated it in KDE Settings GUI, under Startup and Poweroff, Background services.

1

I can confirm that there is definitely a problem with the way KDE represents fonts as a family+style but GTK doesn't, and the GTKd conversion seems to get this wrong.

In my case, I selected DejaVu Sans Condensed in KDE (family DejaVu Sans, style Condensed). The font lines in .config/kdeglobals have the style on the end, like font=DejaVu Sans,11,-1,5,50,0,0,0,0,0,Condensed.

But this produces GTK config files (various, as mentioned) with "DejaVu Sans" as the font name, and GTK needs the style as part of the font name. So editing the kdeglobals to say, font=DejaVu Sans Condensed,11,-1,5,50,0,0,0,0,0 and then logging out/in to rebuild GTK config works for me. Though presumably if I tweak the KDE fonts I may have to edit kdeglobals again!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .