danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.08k stars 133 forks source link

fonts: behaviour is different when in a specialisation #540

Open mighty-spirit opened 2 weeks ago

mighty-spirit commented 2 weeks ago

Hi, and first of all: Amazing nixos module! Thanks so much, it's awesome : )

I use "Fira Code" in all my stylix.fonts settings and I have "Open Sans" declared in gtk.font.name option in home manager for gtk apps. When I am on my base configuration, this works exactly as I want. Terminals use Fira and gtk apps use Sans.

However, when I switch to my light-theme specialisation, which is set to simply inherits all font configs of the base configuration, gtk apps then switch to Fira too, even though both gtk and firefox settings still say that they use Open Sans in their configuration. I even tried to set in firefox to explicitly Open Sans, but in this specialisation, it still uses Fira.

Which just makes me wonder, any idea, why would stylix respect gtk font setting in one case and override them in the other?

And in case that there would not be solution to this, I wondered if it would be possible to get stylix.fonts.enable option, which could be set to false to be able to configure fonts manually?

trueNAHO commented 2 weeks ago

Which just makes me wonder, any idea, why would stylix respect gtk font setting in one case and override them in the other?

Unfortunately, I have not had the time to incorporate specialisations into my own setup, which means that my help is somewhat limited.

Maybe one of the discussions mentioned in https://github.com/danth/stylix/issues/530 could help.

I wondered if it would be possible to get stylix.fonts.enable option, which could be set to false to be able to configure fonts manually?

I will consider this when cleaning up the codebase.

danth commented 2 weeks ago

Are you using NixOS in addition to Home Manager, and if so, do you have them combined into one configuration or are you running Home Manager independently? I'm wondering if this could be caused by the way NixOS copies the settings from your main configuration into the specialisation.

Also, have you considered setting stylix.fonts.sansSerif to Open Sans rather than changing the underlying option?

mighty-spirit commented 2 weeks ago

Also, have you considered setting stylix.fonts.sansSerif to Open Sans rather than changing the underlying option?

Setting stylix.fonts.sansSerif to Open Sans actually did help to force gtk apps to use it even in the specialisation, but it also forced it on alacritty and foot terminals, as they then refuse to use Fira Code in both base config and specialisation.

Are you using NixOS in addition to Home Manager, and if so, do you have them combined into one configuration or are you running Home Manager independently? I'm wondering if this could be caused by the way NixOS copies the settings from your main configuration into the specialisation.

That will surely be it. Base configuration and specialisation must evaluate/inherit nix expression in different order when they are being built, and that is what produces different end results. To my limited knowledge (I am still very new to nix), I have Nixos and Home-Manager combined into one configuration. Very much like with Stylix, I use Home-Manager as Nixos Module.

I will play around with setting higher value to home-manager gtk.font.name option and let you know if that helped.

Thanks to both of you and wish you having a great day!