danth / stylix

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

gtk: support theming at the system level #484

Open sjdrc opened 1 month ago

sjdrc commented 1 month ago

Hi there, thanks very much for this awesome project that pretty much just works out of the box for most things.

I'm using greetd+regreet as a display manager and would like to use themes generated by stylix, but I don't think this is possible as it's the home-manager module that generates the theme files in my home directory that the greeter user doesn't have access to.

Any ideas or suggestions on how to use stylix themes for system-wide installed applications?

trueNAHO commented 1 month ago

Any ideas or suggestions on how to use stylix themes for system-wide installed applications?

Are you using NixOS? In that case, you could integrate Stylix into NixOS: https://stylix.danth.me/options/nixos.html. Otherwise, you could link (ln -s) system files into Stylix generated $HOME files, although these links are sadly not guaranteed to be valid in that case.

sjdrc commented 1 month ago

Yes I am using NixOS, with flakes, and home-manager. I'm using stylix as a NixOS module (that auto imports the home-manager module as far as I understand).

It appears that the gtk theme is only generated with home-manager https://github.com/danth/stylix/blob/master/modules/gtk/hm.nix and cant be found with say, gtkgreet or gdm. How could I get this generated file to be available system wide? (i.e. in /etc or wherever)

danth commented 1 month ago

It looks like GTK supports the same settings files in /etc as it does in ~/.config. If this is the case, then all we'll need to do is generate the config files in the same way Home Manager does.

In the meantime, as a workaround for greetd in particular, it's possible to give the greeter user their own home directory and enable Home Manager for them, which should then install the GTK theme. I have done this myself in the past, using a directory in /tmp or /run since it shouldn't contain anything which needs to be stored permanently.