Add list-tree command - #2229
Open
x41lakazam wants to merge 2 commits into
Open
Conversation
Both are useful to any command that reports container layouts or accepts workspace filters, not just the two that happen to declare them. No behaviour change; this only makes them reusable within their modules.
x41lakazam
added a commit
to x41lakazam/aerospace-layouts
that referenced
this pull request
Aug 17, 2026
list-tree makes the current shape readable, so the daemon can finally tell whether a workspace still looks like its layout instead of only knowing which windows exist. The plan is run through the simulator to find the tree it would build, and that is compared against the tree AeroSpace reports; equal means do nothing. A check that finds nothing to do is one round trip, which is what makes it affordable on every event and every poll -- and that is what makes a layout persist rather than merely being applied once. The command is not in any AeroSpace release. It exists in nikitabobko/AeroSpace#2229, so the daemon probes for it once and falls back to rebuilding on window-set changes when it is missing. Neither mode changes how a rebuild is performed, only when one happens. Only the window set is taken from the tree, never the order. Several layouts interleave -- 2columns puts windows 1,3,5 in the left column -- so a leaf walk returns an order that, fed back in, describes a different arrangement, whose leaf walk describes a third. Taking the order from the tree never settles, which the convergence test catches. The daemon keeps owning the order. Subscribe to binding-triggered and focus-changed as well. Nothing reports a window move, but a keyboard-driven one is always preceded by a binding, so a snap-back looks immediate instead of waiting for the poll. Also accept servers reporting 0.0.0-SNAPSHOT. A build from source reports that however new its tree is, so comparing the number rejected exactly the builds most likely to be ahead of a release -- including the one that has list-tree.
list-windows reports the layout of a window's immediate parent, but nothing reports how the containers nest. A script that wants to reason about the tree has no way to read it back, so it can only rebuild the tree blindly from a known state rather than adjust the part that is wrong. This is the gap that external tools built on top of AeroSpace keep running into. Prints the tiling tree only. Floating, minimized and fullscreen windows are left out, the same way flatten-workspace-tree leaves them out, so that what is printed is exactly what the tiling commands operate on. Workspaces are printed in name order so that the output of a multi-workspace invocation is stable.
x41lakazam
marked this pull request as ready for review
August 24, 2026 13:54
Author
|
Needed by a porting of i3-layouts I built: https://github.com/x41lakazam/aerospace-layouts Probably needed as well for: https://github.com/pfilipp/aerospace-layout-manager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
./test.shexits with non-zero exit code.