Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(home-manager): fix formatting for gtk.nix
Browse files Browse the repository at this point in the history
EnzioKam committed Apr 17, 2024
1 parent 7719fa3 commit 954f29f
Showing 1 changed file with 26 additions and 36 deletions.
62 changes: 26 additions & 36 deletions modules/home-manager/gtk.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
{ config
, pkgs
, lib
, ...
}:
{ config, pkgs, lib, ... }:
let
inherit (lib) ctp mkOption types;
cfg = config.gtk.catppuccin;
enable = cfg.enable && config.gtk.enable;
in
{
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";
};
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";
};

cursor = ctp.mkCatppuccinOpt "gtk cursors"
// {
accent = ctp.mkAccentOpt "gtk cursors";
};
cursor = ctp.mkCatppuccinOpt "gtk cursors" // {
accent = ctp.mkAccentOpt "gtk cursors";
};
};

config = lib.mkIf enable {
assertions = [
(lib.ctp.assertXdgEnabled "gtk")
];
assertions = [ (lib.ctp.assertXdgEnabled "gtk") ];

gtk = {
theme =
@@ -43,13 +34,11 @@ in
sizeUpper = ctp.mkUpper cfg.size;

# use the light gtk theme for latte
gtkTheme =
if cfg.flavour == "latte"
then "Light"
else "Dark";
gtkTheme = if cfg.flavour == "latte" then "Light" else "Dark";
in
{
name = "Catppuccin-${flavourUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
name =
"Catppuccin-${flavourUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
package = pkgs.catppuccin-gtk.override {
inherit (cfg) size tweaks;
accents = [ cfg.accent ];
@@ -70,12 +59,13 @@ in

xdg.configFile =
let
gtk4Dir = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0";
gtk4Dir =
"${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0";
in
{
"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";
};
"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";
};
};
}

0 comments on commit 954f29f

Please sign in to comment.