From 6bccb54a4f98408f22d2e45921bb401f393f2174 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Fri, 11 Apr 2025 17:17:15 +0400 Subject: [PATCH] aerospace: revert flattening on-window-detected rules (#6803) This reverts commits 95861b5d9fc73f080b385776167c3dd2874e355b and d2c014e1c73195d1958abec0c5ca6112b07b79da (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. --- modules/programs/aerospace.nix | 23 +------------------ .../modules/programs/aerospace/aerospace.nix | 20 ---------------- .../programs/aerospace/settings-expected.toml | 13 +---------- 3 files changed, 2 insertions(+), 54 deletions(-) diff --git a/modules/programs/aerospace.nix b/modules/programs/aerospace.nix index 6d24c2241..5685be124 100644 --- a/modules/programs/aerospace.nix +++ b/modules/programs/aerospace.nix @@ -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 ); }; }; diff --git a/tests/modules/programs/aerospace/aerospace.nix b/tests/modules/programs/aerospace/aerospace.nix index 2bbd2ce58..043baa823 100644 --- a/tests/modules/programs/aerospace/aerospace.nix +++ b/tests/modules/programs/aerospace/aerospace.nix @@ -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" ]; - } - ]; }; }; diff --git a/tests/modules/programs/aerospace/settings-expected.toml b/tests/modules/programs/aerospace/settings-expected.toml index f94e8ddc9..b46ebad41 100644 --- a/tests/modules/programs/aerospace/settings-expected.toml +++ b/tests/modules/programs/aerospace/settings-expected.toml @@ -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"]