Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-07-16 19:48:18

Maniaxx
Member
Registered: 2019-07-16
Posts: 8

[Solved] gtk.css - How to set medium font style for thunar and icons

Hallo,
i want to have 'Noto Sans 10 medium' for desktop icons and Thunar (or even all GTK3 apps). How can i achieve that?

This is my ~/.config/gtk-3.0/gtk.css so far but i can't figure out how to set the font weight/style.

* {
	-XfdesktopIconView-cell-spacing: 2px;
	-XfdesktopIconView-cell-padding: 2px;
	-XfdesktopIconView-text-width-proportion: 1.7;
}

I found this but i can't figure out how to adapt it properly.
https://forum.manjaro.org/t/bold-text-xfce/75691

Last edited by Maniaxx (2019-07-19 18:17:37)

Offline

#2 2019-07-17 08:58:46

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,491

Re: [Solved] gtk.css - How to set medium font style for thunar and icons

Hello and welcome.

Maniaxx wrote:

Hallo,
i want to have 'Noto Sans 10 medium' for desktop icons and Thunar (or even all GTK3 apps). How can i achieve that?

Which distro and which version of Xfce are you using? Specifically:

thunar -V
xfdesktop -V
xfsettingsd -V

Generally, in Xfce, you can set system-wide fonts using Settings Manager > Appearance > Fonts. Unless its overridden somewhere else (like ~/.config/gtk-3.0/settings.ini).


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2019-07-17 09:16:49

Maniaxx
Member
Registered: 2019-07-16
Posts: 8

Re: [Solved] gtk.css - How to set medium font style for thunar and icons

I'm on Arch Linux (not atm though so i cannot provide version numbers).
Edit:
Thunar 1.8.7 (Xfce 4.14pre2)
xfdesktop Version 4.13.5
GTK+ 3.24.10
xfsettingsd 4.12.4

Yes, the font can be set system-wide but the 'weight' property gets overridden by the desktop theme or something. The font is always 'regular' (on desktop icons and Thunar/file browsing) no matter what weight i set. The panel at the bottom shows the weight properly.

Last edited by Maniaxx (2019-07-17 19:59:45)

Offline

#4 2019-07-17 11:06:45

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,491

Re: [Solved] gtk.css - How to set medium font style for thunar and icons

I'm not sure what the font weight for medium is (normal is 400, bold is 700 - maybe 100?). You can force all fonts in GTK3 to a certain weight using something like:

* { font-weight: 100; }

...in ~/.config/gtk-3.0/gtk.css. The problem here is you will lose any other font weights (like bold if you ever want to see/use it).

With CSS, you can target specific applications and specific widgets, which might be more useful, but you will need to search for and identify the widgets to affect. To affect all of thunar and xfdesktop icons, you would use something like this:

.thunar * { font-weight: 100 }
XfdesktopIconView.view { font-weight: 100 }

Note, you will need to restart the Thunar Daemon if its running and xfdesktop for the changes to take effect.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2019-07-17 19:54:03

Maniaxx
Member
Registered: 2019-07-16
Posts: 8

Re: [Solved] gtk.css - How to set medium font style for thunar and icons

ToZ wrote:
.thunar * { font-weight: 500 }

This works at least partially, thanks. It only affects the main Thunar browser window (not e.g. options/settings windows). Maybe i should try to replace the whole 'Noto Sans regular' with 'Noto Sans medium' by fontconfig or something. Any idea how this could be done? Fontconfig is heavily overcomplicated.

ToZ wrote:

you will need to search for and identify the widgets to affect.

How did you get that '.thunar' string exactly? I've looked up the string with 'GTK_DEBUG=interactive thunar' but i couldn't find it.

Edit: I've added the version infos above.

Last edited by Maniaxx (2019-07-17 20:01:36)

Offline

#6 2019-07-17 22:44:30

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,491

Re: [Solved] gtk.css - How to set medium font style for thunar and icons

Maniaxx wrote:

How did you get that '.thunar' string exactly? I've looked up the string with 'GTK_DEBUG=interactive thunar' but i couldn't find it.

Running thunar in GTK debug mode, as above, generates the following screen:
HYYPSxs.png
Not that in the Style Classes column it notes two classes, "background" and "thunar". The second one is the one we use because its directed at thunar (as opposed to the first one which would affect all widget classes called "background" in all apps.

Opening one of the preferences dialogs will open another section in the inspector and you will not the style class "dialog-vbox". So to affect thunar dialogs:

.dialog-vbox * { font-weight: 500; }

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2019-07-19 18:16:46

Maniaxx
Member
Registered: 2019-07-16
Posts: 8

Re: [Solved] gtk.css - How to set medium font style for thunar and icons

Thanks. Works properly.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 8 queries executed - Memory usage: 546.28 KiB (Peak: 547.13 KiB) ]