mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
aerospace: Add flattenOnWindowDetected function
This commit is contained in:
parent
80ae77eed3
commit
95861b5d9f
1 changed files with 18 additions and 1 deletions
|
|
@ -23,6 +23,22 @@ let
|
||||||
else
|
else
|
||||||
[ ]) (lib.attrNames set));
|
[ ]) (lib.attrNames set));
|
||||||
filterNulls = filterListAndAttrsRecursive (v: v != null);
|
filterNulls = filterListAndAttrsRecursive (v: v != null);
|
||||||
|
|
||||||
|
# Turns
|
||||||
|
# {if = {foo = "xxx"; bar = "yyy"}}
|
||||||
|
# into
|
||||||
|
# {"if.foo" = "xxx"; "if.bar" = "yyy"}
|
||||||
|
# so that the correct TOML is generated for the
|
||||||
|
# on-window-detected table.
|
||||||
|
flattenConditions = attrs:
|
||||||
|
let conditions = attrs."if" or { };
|
||||||
|
in builtins.removeAttrs attrs [ "if" ]
|
||||||
|
// lib.concatMapAttrs (n: v: { "if.${n}" = v; }) conditions;
|
||||||
|
|
||||||
|
flattenOnWindowDetected = cfg:
|
||||||
|
let owd = cfg.on-window-detected or [ ];
|
||||||
|
in cfg // { on-window-detected = map flattenConditions owd; };
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.hm.maintainers; [ damidoug ];
|
meta.maintainers = with lib.hm.maintainers; [ damidoug ];
|
||||||
|
|
||||||
|
|
@ -234,7 +250,8 @@ in {
|
||||||
home = {
|
home = {
|
||||||
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||||
file.".config/aerospace/aerospace.toml".source =
|
file.".config/aerospace/aerospace.toml".source =
|
||||||
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings);
|
tomlFormat.generate "aerospace"
|
||||||
|
(filterNulls (flattenOnWindowDetected cfg.userSettings));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue