Add --layout filter flag to list-windows - #2217
Open
YuriNachos wants to merge 1 commit into
Open
Conversation
`list-windows` had no way to filter windows by their effective layout, so users could not list floating windows for scratchpad-style workflows (nikitabobko#429). Add a `--layout <target-layout>` sub-filter that accepts the same tokens as the `layout` command (accordion|tiles|horizontal|vertical|h_accordion| v_accordion|h_tiles|v_tiles|tiling|floating) and keeps only windows whose effective parent-container layout matches. Matching reuses the same `getChildParentRelation` source of truth as the `%{window-layout}` interpolation variable: `floating` keeps exactly what that variable reports as `floating`, while the abstract tokens generalize over the orientation-specific variants it prints (`h_tiles` etc.) — `tiling` matches every tiling variant, `tiles`/`accordion` the layout family, `horizontal`/`vertical` the orientation, and `h_*`/`v_*` exactly. Native-fullscreen/minimized/hidden/popup windows match no token. `--layout` composes with `--workspace`/`--monitor`/`--focused`/`--all` exactly like `--pid`/`--app-bundle-id`. Verification is limited to the build, swift tests (two new ListWindowsTest cases), the CLI smoke and strict lint under `./test.sh`; live end-to-end against running windows with Accessibility permission was not exercised. nikitabobko#429
Author
|
This adds the --layout filter to list-windows from #429, reusing the existing effective-layout derivation so the flag filters exactly what the command prints. Given the project's habit of shaping features in Discussions first, is the interface as implemented (regex argument named --layout) acceptable, or would you prefer to weigh the design in a Discussion before it merges? I'm happy to open one or adjust the flag shape either way. |
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.
Closes #429.
Summary
Adds a
--layout <layout>filter flag tolist-windows, so the command prints only the windows whose effective layout matches — e.g.list-windows --layout floatingto list only floating windows (the scratchpad use case from #429).Problem
list-windowscurrently dumps every window across the target workspaces. #429 asks for a way to filter by the window's effective layout — floating windows in particular — which is useful for scripting and for inspecting how AeroSpace assigned windows to layouts.Changes
ListWindowsCmdArgs.swift— new--layout <target-layout>argument. It accepts the same layout tokens thelayoutcommand uses (floating,tiling,tiles,accordion,horizontal,vertical,h_tiles,v_tiles,h_accordion,v_accordion); an invalid token fails withCan't parse '--layout' argument. Possible values: ….format.swift— newwindowMatchesLayoutpredicate. It derives the window's effective layout through the samegetChildParentRelationsource of truth that backs the%{window-layout}interpolation variable, so--layout floatingkeeps exactly what%{window-layout}prints asfloating. The family tokens are inclusive:tilingmatches every tiling variant,tiles/accordionmatch the layout family,horizontal/verticalmatch the orientation, andh_*/v_*match exactly. Windows with no parent or with an illegal/native/popup parent relation match nothing.ListWindowsCommand.swift— applies the filter before the count/format stage, so--countcounts only the matching windows too.ListWindowsTest.swift— newtestParseLayoutFilter(valid tokens parse; an invalid token is rejected with the documented error) andtestRunFilterByLayout(one tiling and one floating window in a workspace; each filter returns only the matching window id). Behavior without the flag is unchanged.Testing
./test.sh(build + test + lint + generate) — all tests passed.Notes
Live end-to-end verification against real windows needs Accessibility permission and a running session; it is not exercised by the headless gate. The unit tests cover the filter logic; the build + lint + generate gate covers compilation.