nikitabobko / AeroSpace

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

Switching to an empty workspace should activate Finder #301

Closed WickedLynx closed 3 months ago

WickedLynx commented 3 months ago

If you switch from a workspace with app windows to an empty workspace, the previous app stays active and any key strokes are forwarded to it. Ideally, switching to an empty workspace should activate Finder (like the default Mission Control behaviour)

For example lets say you have 2 workspaces:

Switching to workspace 2 from workspace 1 activates Safari as expected. But if you switch from workspace 2 to workspace 1, Safari stays active (the menubar doesn't change to Finder), and any keyboard presses will still be sent to Safari.

nikitabobko commented 3 months ago

It's by design

Key strokes are forwarded to the previously focused window. You can use this to create new window for example on empty workspace with cmd+n

There are no reasons to assume that Finder is more important than previously focused window

dvrkoo commented 3 months ago

is it possible to deactivate this? let's say I have a bunch of windows in workspace 1 and I'm done in workspace 2 so I want to close all apps in workspace 2, a wrong number of cmd + q could also close windows from workspace 1 which is not nice. I can see benefit from having the ability of switching it from on to off etc

nikitabobko commented 3 months ago

@dvrkoo There is nothing to deactivate. The current logic was't programmed purposely but appeared as a side effect of "doing nothing with focus" when you switch to empty workspace. And "doing nothing" is the best you can do with macOS flaky focus subsystem.

Your case is "slightly" different anyway, you want AeroSpace to focus Finder when all windows on the workspace close. AeroSpace already tries to force focus windows of the workspace when it detects that other windows on the workspace close #65 and the current implementation is problematic when some apps slow at closing

If the workflow to close all windows on the workspace is often for you, it's better to implement --all-on-workspace flag for close command. Feel free to submit the PR, it's a good first issue, that is easy to implement

nikitabobko commented 3 months ago

Or even better: close --scope (workspace|monitor|all)