mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
dunst: implement settings parameter
This commit is contained in:
parent
420a3f4a01
commit
3160c03843
1 changed files with 57 additions and 17 deletions
|
@ -2,6 +2,22 @@
|
|||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.dunst;
|
||||
toDunstIni = generators.toINI {
|
||||
mkKeyValue = key: value:
|
||||
let
|
||||
value' =
|
||||
if isBool value then (if value then "yes" else "no")
|
||||
else if isString value then "\"${value}\""
|
||||
else toString value;
|
||||
in
|
||||
"${key}=${value'}";
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
|
@ -10,14 +26,32 @@ with lib;
|
|||
enable = mkEnableOption "the dunst notification daemon";
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrs;
|
||||
type = types.attrsOf types.attrs;
|
||||
default = {};
|
||||
description = "Configuration written to ~/.config/dunstrc";
|
||||
example = literalExample ''
|
||||
{
|
||||
global = {
|
||||
geometry = "300x5-30+50";
|
||||
transparency = 10;
|
||||
frame_color = "#eceff1";
|
||||
font = "Droid Sans 9";
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
background = "#37474f";
|
||||
foreground = "#eceff1";
|
||||
timeout = 10;
|
||||
};
|
||||
};
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.services.dunst.enable {
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [
|
||||
{
|
||||
home.file.".local/share/dbus-1/services/org.knopwob.dunst.service".source =
|
||||
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
|
||||
|
||||
|
@ -34,5 +68,11 @@ with lib;
|
|||
ExecStart = "${pkgs.dunst}/bin/dunst";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf (cfg.settings != {}) {
|
||||
home.file.".config/dunst/dunstrc".text = toDunstIni cfg.settings;
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue