Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(home-manager): add support for waybar #133

Merged
merged 8 commits into from
May 1, 2024
22 changes: 21 additions & 1 deletion _sources/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,26 @@
},
"version": "2e74ddba0c582b2ca2d9d06f67f5a902c3a093fb"
},
"waybar": {
"cargoLocks": null,
"date": "2024-03-31",
"extract": null,
"name": "waybar",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "catppuccin",
"repo": "waybar",
"rev": "0830796af6aa64ce8bc7453d42876a628777ac68",
"sha256": "sha256-9lY+v1CTbpw2lREG/h65mLLw5KuT8OJdEPOb+NNC6Fo=",
"type": "github"
},
"version": "0830796af6aa64ce8bc7453d42876a628777ac68"
},
"yazi": {
"cargoLocks": null,
"date": "2024-02-21",
Expand Down Expand Up @@ -719,4 +739,4 @@
},
"version": "0adc53028d81bf047461bc61c43a484d11b15220"
}
}
}
12 changes: 12 additions & 0 deletions _sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,18 @@
};
date = "2023-09-30";
};
waybar = {
pname = "waybar";
version = "0830796af6aa64ce8bc7453d42876a628777ac68";
src = fetchFromGitHub {
owner = "catppuccin";
repo = "waybar";
rev = "0830796af6aa64ce8bc7453d42876a628777ac68";
fetchSubmodules = false;
sha256 = "sha256-9lY+v1CTbpw2lREG/h65mLLw5KuT8OJdEPOb+NNC6Fo=";
};
date = "2024-03-31";
};
yazi = {
pname = "yazi";
version = "0846aed69b2a62d29c98e100af0cf55ca729723d";
Expand Down
41 changes: 41 additions & 0 deletions modules/home-manager/waybar.nix
getchoo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ config
, options
, lib
, sources
, ...
}:
let
cfg = config.programs.waybar.catppuccin;
enable = cfg.enable && config.programs.waybar.enable;
styleFile = "${sources.waybar}/themes/${cfg.flavour}.css";
in
{
options.programs.waybar.catppuccin = (lib.ctp.mkCatppuccinOpt "waybar") // {
mode = lib.mkOption {
type = lib.types.enum [
"prependImport"
"createLink"
];
default = "prependImport";
description = ''
Defines how to include the catppuccin theme css file:

- `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority).
- `createLink`: Creates a symbolic link `~/.config/waybar/catppuccin.css`, which needs to be included in the waybar stylesheet.
'';
};
};

config = lib.mkIf enable (
lib.mkMerge [
(lib.mkIf (cfg.mode == "prependImport") {
programs.waybar.style = lib.mkBefore ''
@import "${styleFile}";
'';
})
(lib.mkIf (cfg.mode == "createLink") {
xdg.configFile."waybar/catppuccin.css".source = styleFile;
})
]
);
}
4 changes: 4 additions & 0 deletions nvfetcher.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ fetch.github = "catppuccin/tmux"
src.git = "https://github.com/catppuccin/tofi.git"
fetch.github = "catppuccin/tofi"

[waybar]
src.git = "https://github.com/catppuccin/waybar.git"
fetch.github = "catppuccin/waybar"

[yazi]
src.git = "https://github.com/catppuccin/yazi.git"
fetch.github = "catppuccin/yazi"
Expand Down
1 change: 1 addition & 0 deletions test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ in
swaylock = enable;
tmux = enable;
tofi = enable;
waybar = enable;
yazi = enable;
zathura = enable;
zellij = enable;
Expand Down