#+title: Aerospace Configuration

Enable Aerospace as a window manager for macOS. I have disabled gaps, move the mouse to follow windows, and an =i3=-like binding configuration.
#+begin_src nix
  { config, pkgs, ... }:

  {
    services.aerospace = {
      enable = true;
      settings = {
        gaps = {
          outer.left = 0;
          outer.bottom = 0;
          outer.top = 0;
          outer.right = 0;
        };
        on-focus-changed = [
          "move-mouse window-lazy-center"
        ];
        on-window-detected = [
          {
            "if".app-name-regex-substring = "mpv";
            run = [
              "layout floating"
            ];
          }
        ];
        workspace-to-monitor-force-assignment = {
          "1" = "main";
          "2" = "main";
          "3" = "main";
          "4" = "main";
          "5" = "main";
          "6" = "main";
          "7" = "main";
          "8" = "main";
          "9" = [
            "secondary"
            "dell"
          ];
          "10" = [
            "secondary"
            "built-in"
          ];
        };
        mode.main.binding = {
          cmd-enter = "exec-and-forget open -n /Applications/Ghostty.app/";
          cmd-shift-enter = "exec-and-forget /opt/homebrew/bin/emacs";
          cmd-d = "exec-and-forget ~/.local/bin/launcher";
          cmd-shift-f = "fullscreen";
          cmd-shift-space = "layout floating tiling";

          cmd-h = "focus --boundaries-action wrap-around-the-workspace left";
          cmd-j = "focus --boundaries-action wrap-around-the-workspace down";
          cmd-k = "focus --boundaries-action wrap-around-the-workspace up";
          cmd-l = "focus --boundaries-action wrap-around-the-workspace right";

          cmd-shift-h = "move left";
          cmd-shift-j = "move down";
          cmd-shift-k = "move up";
          cmd-shift-l = "move right";

          cmd-shift-minus = "resize smart -50";
          cmd-shift-equal = "resize smart +50";

          cmd-1 = "workspace 1";
          cmd-2 = "workspace 2";
          cmd-3 = "workspace 3";
          cmd-4 = "workspace 4";
          cmd-5 = "workspace 5";
          cmd-6 = "workspace 6";
          cmd-7 = "workspace 7";
          cmd-8 = "workspace 8";
          cmd-9 = "workspace 9";
          cmd-0 = "workspace 10";

          cmd-shift-1 = "move-node-to-workspace 1";
          cmd-shift-2 = "move-node-to-workspace 2";
          cmd-shift-3 = "move-node-to-workspace 3";
          cmd-shift-4 = "move-node-to-workspace 4";
          cmd-shift-5 = "move-node-to-workspace 5";
          cmd-shift-6 = "move-node-to-workspace 6";
          cmd-shift-7 = "move-node-to-workspace 7";
          cmd-shift-8 = "move-node-to-workspace 8";
          cmd-shift-9 = "move-node-to-workspace 9";
          cmd-shift-0 = "move-node-to-workspace 10";

          cmd-ctrl-shift-h = "join-with left";
          cmd-ctrl-shift-j = "join-with down";
          cmd-ctrl-shift-k = "join-with up";
          cmd-ctrl-shift-l = "join-with right";
        };
      };
    };
  }
#+end_src
