nikitabobko / AeroSpace

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

Bug: sometimes a window on the focused monitor is focused when a window of the same app on a different monitor was requested to focus #101

Open Jasperswaagman opened 9 months ago

Jasperswaagman commented 9 months ago

Hey Nikita, I'm experiencing the following behavior and I've no idea if it's intended or not. Whenever I've two instances of an application open on different monitors/workspaces. It will focus the instance of the app I last used. I'll try to explain it with an example:

I've a three monitor setup: 1 | 2 | *0

I've the following keybinds to go the specific workspaces:

alt-1 = 'workspace 1'
alt-2 = 'workspace 2'

I want to go to workspace 1 so I press alt-1. I end up at workspace 2. If I press alt-1 again I'll go to workspace 1 as expected.

Is this working as intended? I would like to be able to actually focus a specific window/instance of an app.

Love the app so far, is there a way we can buy you a coffee or beer?

johnallen3d commented 9 months ago

I've experienced a very similar issue with Arc browser. I've had similar issues with Arc and Yabai in the past so I thought it was an Arc specific problem. Perhaps not.

nikitabobko commented 9 months ago

AFAIK it's a bug in Apple accessibility API. If not mistaken, I saw the special workarounds in yabai and/or Amethyst. But right now I can't find it in their codebases and issue trackers (if somebody finds it, it'd be helpful to post links here)

I suspect that this bug might go away if you disable "Displays have separate spaces", but I didn't test it

Jasperswaagman commented 9 months ago

I suspect that this bug might go away if you disable "Displays have separate spaces", but I didn't test it

That does the trick, awesome! Thank you!

carlosflorencio commented 8 months ago

Disabling Displays have separate spaces seems to help with this issue.

But sometimes I have different issue where an app window appears in both monitors. Half window in my left vertical monitor and the other half in my center monitor. The window width is bigger than the workspace/monitor where it was opened (left monitor), like it's missing a resize after opening.

nikitabobko commented 4 months ago

Should be fixed in 0.11.1-Beta

It'd would be cool if somebody can confirm

alexnguyennn commented 4 months ago

I just gave this a try to confirm on 0.11.2-Beta: (with all other automation services e.g. sketchybar, hammerspoon disabled and Displays have separate spaces enabled) it appears I'm still running into the above described issue.

I run 3 external monitors and swapping workspaces seems to still have a different instance of the app on another monitor steal focus specifically when src/destination workspace contain different active apps. Can't seem to see a pattern otherwise (for me it isn't always the last selected, just another visible instance) When changing workspaces where src/destination have the same active app this issue doesn't seem to occur.

Silver lining is that the previous workaround of turning Displays have separate spaces back off still works, though it would be a nice-to-have to be able to turn it off so that full screen doesn't black all other monitors out 😅

nikitabobko commented 4 months ago

@alexnguyennn thanks for checking! I confirm that the problem is still reproducible with 3 monitors.

I normally use 1-2 monitors, and the problem appears to be fixed only for 2 monitors

It's unbelievable how buggy and problematic the API is

alimg commented 4 months ago

I encountered this problem on AeroSpace v0.11.2-Beta 5559f963f6fed4d7b2deff8e064350e18e184c78 today using just 1 external monitor.

I am switching from Amethyst after using for years and problem feels very familiar. But I think it is largely solved nowadays, thanks to this commit: https://github.com/ianyh/Amethyst/pull/1530

jmml97 commented 1 month ago

This is happening to me. My setup is as follows:

If Monitor 1 is on space 1 and Monitor 2 on space 3, when I change to space 4, Monitor 1 also changes to space 2.

The problem seems to happen when switching to a space on the monitor different to the one currently focused.

My Aerospace version:

❯ aerospace --version
aerospace CLI client version: 0.14.2-Beta 0cb8dbdfc5ee73b8cbc200f175f467ebead55201
AeroSpace.app server version: 0.14.2-Beta 0cb8dbdfc5ee73b8cbc200f175f467ebead55201
johnallen3d commented 2 weeks ago

PSA - this "bug" popped back up for me after upgrading to Sequoia. It turns out the upgrade re-enabled the "Displays have separate spaces" settings. 🙄