stylix/modules/gnome/hm.nix
Daniel Thwaites 638f2d86c4
Only run onChange for GNOME when installed 🐛
As GNOME is always enabled on the Home Manager side, the command might
try to run when GNOME is not installed.
2023-02-01 12:29:56 +00:00

41 lines
1.3 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
{
options.stylix.targets.gnome.enable =
config.lib.stylix.mkEnableTarget "GNOME" true;
config = mkIf config.stylix.targets.gnome.enable {
dconf.settings = {
"org/gnome/desktop/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file://${config.stylix.image}";
picture-uri-dark = "file://${config.stylix.image}";
};
# We show the same colours regardless of this setting, and the quick
# settings tile is removed. The value is still used by Epiphany to
# request dark mode for websites which support it.
"org/gnome/desktop/interface".color-scheme =
if config.stylix.polarity == "dark"
then "prefer-dark"
else "default";
"org/gnome/shell/extensions/user-theme".name = "Stylix";
};
xdg.dataFile."themes/Stylix/gnome-shell/gnome-shell.css" = {
source =
let theme = import ./theme.nix { inherit pkgs config; };
in "${theme}/share/gnome-shell/gnome-shell.css";
onChange = ''
if [ -x "$(command -v gnome-extensions)" ]; then
gnome-extensions disable user-theme@gnome-shell-extensions.gcampax.github.com
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
fi
'';
};
};
}