nikitabobko / AeroSpace

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

Avoid workspace switching when opening notifications? #331

Open chasingtheflow opened 1 month ago

chasingtheflow commented 1 month ago

I have the following setup / issue:

I have a workspace on a secondary monitory assigned to 0 to which Apple Mail is assigned. However, much of the time that monitor is actually displaying workspace 8. I also am using the on-window-detected callback to make any subsequent mail windows float (which is working).

However, my issue is that if I'm working on my primary monitor (workspace 1) and I receive an email. If I open the email by clicking the notification as it arrives in the top right of my monitor then the new email opens floating in my main monitor on workspace 1. Which is perfect. However, my secondary monitor switches from whatever workspace it's on currently to workspace 0 which also has the main mail window open. Is there a way to avoid this? I'd prefer the secondary monitory stay on the workspace it's currently on.

nikitabobko commented 1 month ago

You can try to disable "Displays have separate spaces" to see if the problem goes away

I suspect that the issue is duplicate of #101

chasingtheflow commented 1 month ago

Thanks ... this does change the behavior a bit but doesn't totally resolve it. When I open the notification the workspace doesn't switch but when I close that window then it seems to switch.

Different topic, and I can open a separate issue if you're interested in it, but for floating windows I think it might be interesting if you use the move command, or a new command, to "nudge" the window in a direction so even for floating windows you wouldn't need to reach for a mouse. So for example you could use alt-shift-h to slide a window to the left.

nikitabobko commented 1 month ago

but when I close that window then it seems to switch

Well, focus managment is complicated. When a window closes, AeroSpace tries to keep the focus on the currently focused workspace, but if the timing is wrong it doesn't always succeed even with a single monitor, not to mention two monitors. I might come up with ideas on how to better handle it, but right now it's indeed unreliable

but for floating windows I think it might be interesting if you use the move command

Yes, it should work like that, I just didn't have time to implement it. For floating windows, move command should move windows in the appropriate direction. An optional --floating-pixels <pixels> flag could be introduced to configure how far the window should be moved. Feel free to open a new issue if you want to be able track the progress on this feature. Also it's very easy to implement, so feel free to submit a PR