This commit is contained in:
xunuwu 2024-09-27 21:07:44 +02:00
parent 448372de7a
commit ffa3121602
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
11 changed files with 243 additions and 38 deletions

View file

@ -0,0 +1,71 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.xun.desktop;
dark = {
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
gtk = {
theme = {
package = pkgs.gnome-themes-extra;
name = "Adwaita-dark";
};
iconTheme = {
package = pkgs.adwaita-icon-theme;
name = "Adwaita-dark";
};
gtk2.extraConfig = "gtk-application-prefer-dark-theme=1";
gtk3.extraConfig.gtk-application-prefer-dark-theme = 1;
gtk4.extraConfig.gtk-application-prefer-dark-theme = 1;
};
qt = {
platformTheme.name = "gtk3";
style = {
name = "Adwaita-dark";
package = pkgs.adwaita-qt;
};
};
};
light = {
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-light";
gtk = {
theme = {
package = pkgs.gnome-themes-extra;
name = "Adwaita";
};
iconTheme = {
package = pkgs.adwaita-icon-theme;
name = "Adwaita";
};
gtk2.extraConfig = "gtk-application-prefer-dark-theme=false";
gtk3.extraConfig.gtk-application-prefer-dark-theme = 0;
gtk4.extraConfig.gtk-application-prefer-dark-theme = 0;
};
qt = {
style = {
name = "adwaita";
package = pkgs.adwaita-qt;
};
};
};
in {
options.xun.desktop.colorscheme = lib.mkOption {
default = null;
type = lib.types.enum [null "dark" "light"]; # might add more in the future
};
config = lib.mkIf (cfg.colorscheme != null) (lib.mkMerge [
(lib.mkIf (cfg.colorscheme == "dark") dark)
(lib.mkIf (cfg.colorscheme == "light") light)
]);
# config = lib.mkIf (cfg.colorscheme != null) (let
# switch = {
# dark = {};
# light = {};
# };
# in
# switch."${toString cfg.colorscheme}");
}

View file

@ -6,11 +6,27 @@
}: let
cfg = config.xun.desktop;
in {
imports = [
./colorscheme
];
options.xun.desktop = {
xdg.enable = lib.mkEnableOption "xdg env vars";
# colorscheme = lib.mkOption {
# default = null;
# type = lib.types.enum ["dark" "light"];
# };
};
config = lib.mkMerge [
# (let
# switch = {
# "dark" = {};
# "light" = {};
# };
# in
# switch."${toString cfg.colorscheme}")
(lib.mkIf cfg.xdg.enable {
xdg = let
home = config.home.homeDirectory;