nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
7.41k stars 119 forks source link

Feature request: Introduce `if.is-leader-window` condition to`[[on-window-detected]]` #71

Open januz opened 10 months ago

januz commented 10 months ago

I was wondering whether you could include the possibility to specify a condition based on the window ID. Specifically, I would like the main application window of my email client to be managed but automatically float (and ideally center) the windows for new emails I'm writing.

While not perfect, using the window ID could be used to infer that a window is a child window (in this case a new email window).

nikitabobko commented 10 months ago

using the window ID could be used to infer that a window is a child window

I suppose that you suggest that windows that appear later have a bigger window ID. I didn't check that, but even if it's true, I don't want to rely on that logic. Apple didn't guarantee this logic (frankly speaking, getting window ID is a private API, so Apple guaranteed nothing)

I'd suggest another solution: introduce the concept of a "leader window"

The concept could also be called "main window", but I don't want to use the term "main" because macOS accessibility API has some notion of "main window", which means something different (I have never seen the "main window" to be different from "focused window")

januz commented 10 months ago

If the app has several windows then the earliest detected window is considered the leader

That would be great, yes!

wojciech-kulik commented 10 months ago

@nikitabobko regarding your comment, this feature would be useful almost in every app to exclude settings windows, some panels (for example in Xcode when you hit CMD+Shift+O), dialogs, color pickers, etc., etc.

nikitabobko commented 10 months ago

this feature would be useful almost in every app

Can you please specify concrete names? Different people use different apps

For example, my "almost every apps" are: Chrome, IntelliJ IDEA, Alacritty, Spotify. And I don't need "is leader window" in either of them.

It's hard for me to understand the necessity of "leader window" concept if I don't have examples

for example in Xcode when you hit CMD+Shift+O

It's a popup on my machine which is not layouted by AeroSpace

image

Is it layouted on your machine?

wojciech-kulik commented 10 months ago

I checked what could cause that in my config and it turns out that it happens because I'm using the approach with "floating" by default and then per selected apps I use:

[[on-window-detected]]
if.app-name-regex-substring = 'xcode'
run = ['layout tiling', 'move-node-to-workspace 4']

How can I achieve the same without annoying tiling of child windows?

nikitabobko commented 10 months ago

How can I achieve the same without annoying tiling of child windows?

@wojciech-kulik -> #103