Skip to content

Add list-tree command - #2229

Open
x41lakazam wants to merge 2 commits into
nikitabobko:mainfrom
x41lakazam:list-tree
Open

Add list-tree command#2229
x41lakazam wants to merge 2 commits into
nikitabobko:mainfrom
x41lakazam:list-tree

Conversation

@x41lakazam

@x41lakazam x41lakazam commented Aug 16, 2026

Copy link
Copy Markdown

PR checklist

  • Explain your changes in the relevant commit messages rather than in the PR description. The PR description must not contain more information than the commit messages (except for images and other media).
  • Each commit must explain what/why/how and motivation in its description. https://cbea.ms/git-commit/
  • Don't forget to link the appropriate issues/discussions in commit messages (if applicable).
  • Each commit must be an atomic change (a PR may contain several commits). Don't introduce new functional changes together with refactorings in the same commit.
  • ./test.sh exits with non-zero exit code.
  • Avoid merge commits, always rebase and force push.

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.
@github-actions github-actions Bot added the not-actionable By default, all PRs have this label. If the PR makes sense, the label will be removed. label Aug 16, 2026
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
x41lakazam marked this pull request as ready for review August 24, 2026 13:54
@x41lakazam

x41lakazam commented Aug 24, 2026

Copy link
Copy Markdown
Author

Needed by a porting of i3-layouts I built: https://github.com/x41lakazam/aerospace-layouts
Note: aerospace-layouts is an external script in the manner of i3-layout.

Probably needed as well for: https://github.com/pfilipp/aerospace-layout-manager

Related discussions:
#260
#1608
#756
#1330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-actionable By default, all PRs have this label. If the PR makes sense, the label will be removed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant