alt-tab-macos
alt-tab-macos copied to clipboard
feat: add option to minimize other windows when switching
This PR adds a feature to minimise other windows, both as an intentional action from the switching window, and as a configurable default action when completing a switch.
I'm not sure you'll want to keep adding features to AltTab until it becomes all things to all people, so I won't be offended if you'd prefer not to add this functionality :-) There do look to be a few requests for something similar: https://github.com/lwouis/alt-tab-macos/issues/1530, https://github.com/lwouis/alt-tab-macos/issues/1902, https://github.com/lwouis/alt-tab-macos/issues/2086 . These FRs asked for the ability to hide other apps on switching, but that feels like quite a heavy action on MacOS - hiding all windows across all spaces - whereas minimising other windows can be implemented in a way that just applies to the set of windows that the current AltTab action is applying to, whether that be a single space or all spaces.
I've tried to change the existing logic as little as possible, as my impression is that it's probably been polished in the face of a thousand edge cases! I'm not sure the implementation is as clean as it could be, and we could happily streamline it if you're happy to risk changing the logic more (in particular, the thing that could be cleaned up, I think, is how the "action" to either focus the selected window, or minimise the other windows is triggered inside ATShortcut
when the triggerPhase
is up
).
Hi @JonyEpsilon 👋
This PR adds a feature to minimise other windows, both as an intentional action from the switching window, and as a configurable default action when completing a switch.
I'm not sure you'll want to keep adding features to AltTab until it becomes all things to all people, so I won't be offended if you'd prefer not to add this functionality :-) There do look to be a few requests for something similar: https://github.com/lwouis/alt-tab-macos/issues/1530, https://github.com/lwouis/alt-tab-macos/issues/1902, https://github.com/lwouis/alt-tab-macos/issues/2086 .
I think it's ok to add yet another preference, if it's in the existing dropdown "On release:". I think it's a dropdown very few people touch in the first place, so it's ok to cram another power-user option there. Regarding adding a new secondary shortcut, I think it's too niche to warrant the added complexity though.
These FRs asked for the ability to hide other apps on switching, but that feels like quite a heavy action on MacOS - hiding all windows across all spaces - whereas minimising other windows can be implemented in a way that just applies to the set of windows that the current AltTab action is applying to, whether that be a single space or all spaces.
I made a comment in the PR to discuss the topic of which windows should be affected by the trigger.
I will add, regarding other people wanting to hide windows instead of minimizing, that I think if we add this feature, we could as well add yet another dropdown option to hide instead of minimizing.
I've tried to change the existing logic as little as possible, as my impression is that it's probably been polished in the face of a thousand edge cases! I'm not sure the implementation is as clean as it could be, and we could happily streamline it if you're happy to risk changing the logic more (in particular, the thing that could be cleaned up, I think, is how the "action" to either focus the selected window, or minimise the other windows is triggered inside ATShortcut when the triggerPhase is up).
You're very kind. I think the codebase is a bit messy, as a result of the million complexities and tricks we do to get macOS to comply to basic functionality (e.g. there is no public API to manipulate Spaces, so we use private APIs/SPIs and side-effects to detect things).
The code in this PR is of very good quality, in my eyes. I think if you're ok to make a few changes from my suggestions, I can merge this PR and release soon after 👍
Hey, just a very quick comment to say that the above all sounds reasonable, and I'll update the PR when I have a chance - been a bit busy lately.
I might need some advice on how to select the proper set of windows to minimise, but I should think about it myself first!