Skip to content

Conversation

@kim-raaschou
Copy link

@kim-raaschou kim-raaschou commented Jan 27, 2026

Add --sort-by dfs-index flag to list-windows command
Addresses issue #491.
Non-Breaking Change ✅

  • Default sorting unchanged (alphabetical by app name and title)
  • Opt-in flag: --sort-by dfs-index preserves DFS traversal order
  • Consistent with existing focus --dfs-index command (PR #464)
    Features

1. --sort-by dfs-index flag

  • Preserves DFS order from allLeafWindowsRecursive
  • Works with --format and --json
  • Incompatible with --count

2. DFS structure change detection

  • Triggers exec-on-workspace-change when window tree structure changes
  • Enables dynamic workspace monitoring (e.g., status bars)
  • AEROSPACE_FOCUSED_WORKSPACE == AEROSPACE_PREV_WORKSPACE indicates DFS change (not workspace switch)

Adds a --sort-by flag that accepts 'dfs-index' as a value to preserve
the depth-first search traversal order of windows in the tree structure.

When not specified, windows are sorted by application name then title
(existing default behavior remains unchanged).

The flag is incompatible with --count.
@kim-raaschou kim-raaschou force-pushed the feature/add-dfs-sort-by branch from 78c1b90 to 6e52517 Compare January 27, 2026 10:05
@kim-raaschou kim-raaschou marked this pull request as ready for review January 27, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants