nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
8.01k stars 131 forks source link

How to programmatically create and manage nodes? #609

Closed wbsmolen closed 1 month ago

wbsmolen commented 1 month ago

I'm trying to use my config file to drive actions that Aerospace should run on-startup. I have 3 monitors and I want to move a workspace to each monitor. Then I want Workspace 1 (on an ultrawide) to have 2 nodes, 1 horizontally tiled and 1 vertically tiled.

Workspaces 2 and 3 have 1 node.

I want the config to use exec-and-forget to launch specific apps and place them in the workspaces. This is where I'm having my problem.

I'm trying to use after-startup-command:

after-startup-command = [
    "move-workspace-to-monitor --workspace 3 --wrap-around next",
    "move-workspace-to-monitor --workspace 2 --wrap-around prev",

    "workspace 1",
    "layout horizontal",
    "exec-and-forget open -a '<browser app>'",  
    "exec-and-forget open -a '<browser app>' --args --new-window", 
    "exec-and-forget open -a '<browser app>' --args --new-window",  
    "exec-and-forget open -a '<some app>'", 
    "split vertical",  
    "exec-and-forget open -a '<some app>'",  
    "exec-and-forget open -a '<some app>'",  

    "workspace 2",
    "layout vertical",
    "exec-and-forget open -a '<some app>'",
    "exec-and-forget open -a '<some app>'",

    "workspace 3",
    "layout horizontal",
    "exec-and-forget open -a '<some app>'"
]

But this isn't working. I looked at using exec-on-workspace-change but that would require Aerospace exposing an api for node management so a foreign bash script could leverage it. I don't believe that exists.

Checklist

nikitabobko commented 1 month ago

Opening windows/applications happens with the delay.

The use case that you describe is not about programmatically creating nodes, but about waiting till the windows appear and become accessible for manipulation

Duplicate of #226