koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
23.45k stars 644 forks source link

Add stack ID attribute to windows #672

Open AdamWagner opened 4 years ago

AdamWagner commented 4 years ago

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 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:

❯ 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.

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

koekeishiya commented 4 years ago

I don't think stacks will be considered its own entity in the query system, but I can see the use of stacks having an internal id that would be included as an attribute alongside the stack-index in window queries.

As for signals, the current system is not capable of providing custom signals that are not directly mapped 1-to-1 with the macOS notifications that we observe, and so this is unlikely to happen for quite some time. There are other benefits to changing the signal system as well, such as #581

AdamWagner commented 4 years ago

but I can see the use of stacks having an internal id that would be included as an attribute alongside the stack-index in window queries.

Yep, that ↑ would work fine.

And it's helpful to know that signals for stacks is unlikely. Very helpful!

AdamWagner commented 3 years ago

@koekeishiya I updated the issue title to reflect your last comment. It'd be helpful to have a sense of when (soon / not soon) you expect a stack ID attribute could be added to windows, since it affects design decisions in stackline. Thanks!

nbcomplete commented 3 years ago

@koekeishiya

I don't think stacks will be considered its own entity in the query system, but I can see the use of stacks having an internal id that would be included as an attribute alongside the stack-index in window queries.

However, it would be helpful to have control over them with rules. Right now it's not possible to configure a layout that uses stacks. The stacking layer that can be configured there seems to be a completely different concept that doesn't interact with the normal window stacking that can be achieved via window commands.

koekeishiya commented 3 years ago

This is outside the scope of what rules are meant to be used for. If you want to somehow automate layouts, use the signal system instead.

Sent from my iPhone

On 21 Dec 2020, at 17:25, nbcomplete notifications@github.com wrote:



@koekeishiyahttps://github.com/koekeishiya

I don't think stacks will be considered its own entity in the query system, but I can see the use of stacks having an internal id that would be included as an attribute alongside the stack-index in window queries.

However, it would be helpful to have control over them with rules. Right now it's not possible to configure a layout that uses stacks. The stacking layer that can be configured there seems to be a completely different concept that doesn't interact with the normal window stacking that can be achieved via window commands.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/koekeishiya/yabai/issues/672#issuecomment-749060029, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABPDZV5FPVJKBS4U5TSY5NTSV5ZG7ANCNFSM4R3CFHNQ.