Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
januz opened this issue Dec 26, 2023 · 6 comments

Comments

@januz
Copy link

januz commented Dec 26, 2023

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
Copy link
Owner

nikitabobko commented Dec 26, 2023

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"

  • If the app has a single window then it's considered to be the leader
  • If the app has several windows then the earliest detected window is considered the leader

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
Copy link
Author

januz commented Dec 26, 2023

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

That would be great, yes!

@nikitabobko nikitabobko changed the title [[on-window-detected]]--use window ID Feature request: Introduce if.is-leader-window condition to[[on-window-detected]] Dec 26, 2023
@wojciech-kulik
Copy link
Contributor

@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
Copy link
Owner

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
Copy link
Contributor

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
Copy link
Owner

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

@wojciech-kulik -> #103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants