2024-05-21 14:53:46 -07:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
2023-07-13 09:17:51 -07:00
|
|
|
}:
|
|
|
|
let
|
2024-05-21 14:53:46 -07:00
|
|
|
inherit (lib)
|
|
|
|
ctp
|
|
|
|
mkOption
|
|
|
|
mkEnableOption
|
|
|
|
types
|
|
|
|
;
|
2023-07-13 09:17:51 -07:00
|
|
|
cfg = config.gtk.catppuccin;
|
|
|
|
enable = cfg.enable && config.gtk.enable;
|
2024-04-18 13:10:23 -07:00
|
|
|
# "dark" and "light" can be used alongside the regular accents
|
2024-05-21 14:53:46 -07:00
|
|
|
cursorAccentType = ctp.mergeEnums ctp.types.accentOption (
|
|
|
|
lib.types.enum [
|
|
|
|
"dark"
|
|
|
|
"light"
|
|
|
|
]
|
|
|
|
);
|
2023-07-13 09:17:51 -07:00
|
|
|
in
|
|
|
|
{
|
2024-05-21 14:53:46 -07:00
|
|
|
options.gtk.catppuccin = ctp.mkCatppuccinOpt "gtk" // {
|
|
|
|
accent = ctp.mkAccentOpt "gtk";
|
|
|
|
size = mkOption {
|
|
|
|
type = types.enum [
|
|
|
|
"standard"
|
|
|
|
"compact"
|
|
|
|
];
|
|
|
|
default = "standard";
|
|
|
|
description = "Catppuccin size variant for gtk";
|
|
|
|
};
|
|
|
|
tweaks = mkOption {
|
|
|
|
type = types.listOf (
|
|
|
|
types.enum [
|
|
|
|
"black"
|
|
|
|
"rimless"
|
|
|
|
"normal"
|
|
|
|
]
|
|
|
|
);
|
|
|
|
default = [ "normal" ];
|
|
|
|
description = "Catppuccin tweaks for gtk";
|
|
|
|
};
|
|
|
|
gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell";
|
2023-11-04 16:46:21 -07:00
|
|
|
|
2024-05-21 14:53:46 -07:00
|
|
|
cursor = ctp.mkCatppuccinOpt "gtk cursors" // {
|
|
|
|
accent = ctp.mkBasicOpt "accent" cursorAccentType "gtk cursors";
|
|
|
|
};
|
2024-05-13 21:09:27 -07:00
|
|
|
|
2024-05-21 14:53:46 -07:00
|
|
|
icon = ctp.mkCatppuccinOpt "gtk modified Papirus icon theme" // {
|
|
|
|
accent = ctp.mkAccentOpt "gtk modified Papirus icon theme";
|
2023-04-14 19:32:44 -07:00
|
|
|
};
|
2024-05-21 14:53:46 -07:00
|
|
|
};
|
2023-04-14 19:32:44 -07:00
|
|
|
|
2024-04-18 08:02:10 -07:00
|
|
|
config = lib.mkIf enable {
|
|
|
|
gtk = {
|
|
|
|
theme =
|
|
|
|
let
|
2024-05-21 17:23:55 -07:00
|
|
|
flavorUpper = ctp.mkUpper cfg.flavor;
|
2024-04-18 08:02:10 -07:00
|
|
|
accentUpper = ctp.mkUpper cfg.accent;
|
|
|
|
sizeUpper = ctp.mkUpper cfg.size;
|
|
|
|
|
|
|
|
# use the light gtk theme for latte
|
2024-05-21 17:23:55 -07:00
|
|
|
gtkTheme = if cfg.flavor == "latte" then "Light" else "Dark";
|
2024-04-18 08:02:10 -07:00
|
|
|
in
|
|
|
|
{
|
2024-05-21 17:23:55 -07:00
|
|
|
name = "Catppuccin-${flavorUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
|
2024-04-18 08:02:10 -07:00
|
|
|
package = pkgs.catppuccin-gtk.override {
|
|
|
|
inherit (cfg) size tweaks;
|
|
|
|
accents = [ cfg.accent ];
|
2024-05-21 17:23:55 -07:00
|
|
|
variant = cfg.flavor;
|
2024-04-18 08:02:10 -07:00
|
|
|
};
|
2023-11-04 16:46:21 -07:00
|
|
|
};
|
|
|
|
|
2024-04-18 08:02:10 -07:00
|
|
|
cursorTheme =
|
|
|
|
let
|
|
|
|
accentUpper = ctp.mkUpper cfg.cursor.accent;
|
|
|
|
in
|
|
|
|
lib.mkIf cfg.cursor.enable {
|
2024-06-10 12:54:48 -07:00
|
|
|
name = "catppuccin-${cfg.cursor.flavor}-${cfg.cursor.accent}-cursors";
|
2024-05-21 17:23:55 -07:00
|
|
|
package = pkgs.catppuccin-cursors.${cfg.cursor.flavor + accentUpper};
|
2024-04-18 08:02:10 -07:00
|
|
|
};
|
2024-05-13 21:09:27 -07:00
|
|
|
|
|
|
|
iconTheme =
|
|
|
|
let
|
|
|
|
# use the light icon theme for latte
|
2024-05-21 17:23:55 -07:00
|
|
|
polarity = if cfg.icon.flavor == "latte" then "Light" else "Dark";
|
2024-05-13 21:09:27 -07:00
|
|
|
in
|
|
|
|
lib.mkIf cfg.icon.enable {
|
|
|
|
name = "Papirus-${polarity}";
|
2024-05-21 17:23:55 -07:00
|
|
|
package = pkgs.catppuccin-papirus-folders.override { inherit (cfg.icon) accent flavor; };
|
2024-05-13 21:09:27 -07:00
|
|
|
};
|
2024-04-18 08:02:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
xdg.configFile =
|
2023-11-04 16:46:21 -07:00
|
|
|
let
|
2024-04-18 08:02:10 -07:00
|
|
|
gtk4Dir = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0";
|
2023-11-04 16:46:21 -07:00
|
|
|
in
|
2024-04-18 08:02:10 -07:00
|
|
|
{
|
|
|
|
"gtk-4.0/assets".source = "${gtk4Dir}/assets";
|
|
|
|
"gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css";
|
|
|
|
"gtk-4.0/gtk-dark.css".source = "${gtk4Dir}/gtk-dark.css";
|
2023-11-04 16:46:21 -07:00
|
|
|
};
|
2024-05-13 11:04:05 -07:00
|
|
|
|
|
|
|
home.packages = lib.mkIf cfg.gnomeShellTheme [ pkgs.gnomeExtensions.user-themes ];
|
|
|
|
|
|
|
|
dconf.settings = lib.mkIf cfg.gnomeShellTheme {
|
|
|
|
"org/gnome/shell" = {
|
|
|
|
disable-user-extensions = false;
|
2024-05-21 14:53:46 -07:00
|
|
|
enabled-extensions = [ "user-theme@gnome-shell-extensions.gcampax.github.com" ];
|
2024-05-13 11:04:05 -07:00
|
|
|
};
|
|
|
|
"org/gnome/shell/extensions/user-theme" = {
|
2024-05-20 20:53:33 -07:00
|
|
|
inherit (config.gtk.theme) name;
|
2024-05-13 11:04:05 -07:00
|
|
|
};
|
|
|
|
"org/gnome/desktop/interface" = {
|
2024-05-21 17:23:55 -07:00
|
|
|
color-scheme = if cfg.flavor == "latte" then "default" else "prefer-dark";
|
2024-05-13 11:04:05 -07:00
|
|
|
};
|
|
|
|
};
|
2023-11-04 16:46:21 -07:00
|
|
|
};
|
2023-04-14 19:32:44 -07:00
|
|
|
}
|