aerospace: revert flattening on-window-detected rules (#6803)

This reverts commits 95861b5d9f and
d2c014e1c7 (PR #6778), as they broke
Aerospace configuration loading. Whilst the generated TOML configuration
wasn't the best, it was completely valid, whereas after the
aforementioned PR it was no longer valid.
This commit is contained in:
andre4ik3
2025-04-11 17:17:15 +04:00
committed by GitHub
parent f0c69ede70
commit 6bccb54a4f
3 changed files with 2 additions and 54 deletions

View File

@@ -35,27 +35,6 @@ let
) (lib.attrNames set)
);
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
{
meta.maintainers = with lib.hm.maintainers; [ damidoug ];
@@ -291,7 +270,7 @@ in
home = {
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
file.".config/aerospace/aerospace.toml".source = tomlFormat.generate "aerospace" (
filterNulls (flattenOnWindowDetected cfg.userSettings)
filterNulls cfg.userSettings
);
};
};

View File

@@ -14,26 +14,6 @@
alt-k = "focus up";
alt-l = "focus right";
};
on-window-detected = [
{
"if" = {
app-id = "com.apple.MobileSMS";
};
run = [ "move-node-to-workspace 10" ];
}
{
"if" = {
app-id = "ru.keepcoder.Telegram";
};
run = [ "move-node-to-workspace 10" ];
}
{
"if" = {
app-id = "org.whispersystems.signal-desktop";
};
run = [ "move-node-to-workspace 10" ];
}
];
};
};

View File

@@ -8,6 +8,7 @@ enable-normalization-opposite-orientation-for-nested-containers = true
exec-on-workspace-change = []
on-focus-changed = []
on-focused-monitor-changed = ["move-mouse monitor-lazy-center"]
on-window-detected = []
start-at-login = false
[gaps.outer]
@@ -24,15 +25,3 @@ alt-h = "focus left"
alt-j = "focus down"
alt-k = "focus up"
alt-l = "focus right"
[[on-window-detected]]
"if.app-id" = "com.apple.MobileSMS"
run = ["move-node-to-workspace 10"]
[[on-window-detected]]
"if.app-id" = "ru.keepcoder.Telegram"
run = ["move-node-to-workspace 10"]
[[on-window-detected]]
"if.app-id" = "org.whispersystems.signal-desktop"
run = ["move-node-to-workspace 10"]