asmvik / asmvik/yabai

Add stack ID attribute to windows

Open
#672 5 comments 4 reactions 0 assignees View on GitHub
suggestion
Dominant language
C
Stars
29.6k
Forks
750
PR merge metrics
No merged PRs in 30d

Description

I'm curious if you intend stacks to be a first class citizen: identifiable by `id`, queryable via `yabai -m query --stacks …` etc?

**1) Ability to query stacks**
I ask because, currently, [stackline's](https://github.com/AdamWagner/stackline) stack detection is the worst of both worlds – complicated _and_ crappy :-) Lacking a mechanism to query stacks directly, stackline assumes that windows that occupy the same space (`a.frame == b.frame`) are in a stack. This is quite fragile:

1. `zoom-parent` and `zoom-fullscreen` may result in false positives (possible to mitigate by filtering out zoomed-windows, but stacked windows may _also_ be zoomed, and this adds yet more complexity)
2. apps that constrain window dimensions (such as iTerm2, grrr!) often result in false negatives (i.e., the dimensions of such an app's window _are not_ equal to those of its stacked siblings). I'm working on an update to add fuzzy frame matching, but this has its own failure cases.
3. similarly, apps with a minimum window size constraint (most apps) also result in false negatives

I would much prefer to query stack data directly from `yabai`. For example:

```sh
❯ yabai -m query --stacks --space
→ [ {"id": 405386, "focused": false, "zoom-parent": 0, "zoom-fullscreen": 0, "windows": [123456, 789123, …], {…}]
```

**2) Signals for stacks**

Stackline's logic for tracking stack state is also really complicated. If you don't think stack signals are going to be added soon, I'll take another pass at trying to simplify it as-is.

- stack_changed (would be even better to differentiate cosmetic changes (move/resize) from structural changes (member added/removed)
- stack_added
- stack_removed

Let me know if you want me to split this into 2 issues.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests. Start with the existing `yabai -m query` interface and the requested `yabai -m query --stacks --space` output; done would require an agreed scope for stack queries and/or signals, plus defined behavior and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
cli, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.