this post was submitted on 02 Jun 2025
12 points (100.0% liked)

Nix / NixOS

2245 readers
2 users here now

Main links

Videos

founded 2 years ago
MODERATORS
 

Basically the title. I would like apps that auto detect system theme to see it as dark mode. I’ve come across post after post of doing this with home manager, but I’d like to just do it in my base nix config. I tried a few different ways to declare what I thought was being done in the home manager tutorials in my config, but none of it worked. Any help would be greatly appreciated!

top 5 comments
sorted by: hot top controversial new old
[–] rycee@lemmy.world 6 points 5 days ago (3 children)

If you have a mostly Gnome system then you can make sure to run these lines when you login:

dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita-dark'"

I have two simple shell scripts, prefer-light and prefer-dark that I run when I want to switch:

❯ cat $(which prefer-dark)
#!/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/bash

dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita-dark'"

❯ cat $(which prefer-light)
#!/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/bash

dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita'"

If you want to go deeper and also affect Qt applications and such, then you can always look at the Home Manager source code to see the files that it writes when you follow the tutorials.

[–] axEl7fB5@lemmy.cafe 1 points 2 days ago* (last edited 2 days ago)

rycee??? Never knew the person who made Home Manager is also here. I just noticed

[–] axEl7fB5@lemmy.cafe 2 points 2 days ago* (last edited 2 days ago) (1 children)

I know OP doesn't want to use Home Manager and doesn't use GNOME, but for the other people who use it: you can configure it like this:

dconf.settings."org/gnome/desktop/interface" = {
  color-scheme = "prefer-dark";
  gtk-theme = "Adwaita-dark";
};

I got this from a blog: https://web.archive.org/web/20220927232409/https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/.

[–] Arkhive@lemmy.blahaj.zone 1 points 2 days ago

Yes! Love that you did this. Helping make the fediverse a knowledge base like the other site was. 🫡

[–] Arkhive@lemmy.blahaj.zone 2 points 5 days ago

Shoot, I should have mentioned. Hyprland is my DE, but I’m probably swapping to Niri in the future. I think I can still use something like the “dconf write” in my hyprland config, but then when I move to Niri I’ll have to figure it out again.