lwouis / alt-tab-macos

Windows alt-tab on macOS
https://alt-tab-macos.netlify.app
GNU General Public License v3.0
10.59k stars 322 forks source link

Don't hide AltTab during Mission Control's "Show Desktop" #960

Open ilyabirman opened 3 years ago

ilyabirman commented 3 years ago

When macOS is in Show Desktop state (i.e. after using a Hot Corner), so that all the windows have temporarily moved to the sides, pressing ⌘Tab does not summon AltTab switcher interface. This makes it impossible to drag a file from Desktop and drop it into an application inside the switcher, which I would do with the system app switcher.

  1. Set up a Hot Corner with System Preferences → Mission Control to use “Desktop” command i.e. like this: https://d.pr/i/dpMPX1
  2. Move the mouse pointer to the selected screen corner. All your windows will fly away to show Desktop.
  3. Press ⌘Tab... Nothing happens.
lwouis commented 3 years ago

Hi @ilyabirman

I implemented this behavior on purpose, and it was actually hard to implement (private APIs and workarounds).

The reason I implemented to disable AltTab when Mission Control is open is the following. I noticed this interaction was possible during development. It was kind of goofy since when you released the keys, it would focus the window, while still staying in MC. Imagine the blue outline of the thumbnail'ed windows of MC "zoomed out" view changing focus.

Faced with that unintuitive UX, I looked at Apple HIG as well as the docs of certain methods/attributes of AppKit. I realized some HUD and modals are supposed to hide during MC. I also noticed that the built-in app switcher is disabled during MC. AltTab tries to be consistent with the built-in switcher.

In addition to what is should do in that situation not being clear, and a lot of similar example cases leading to disable AltTab, there is the case of other interactions (e.g. releasing shortcut in the middle of Space transitions) which interact with AltTab and the OS in ways similar to MC (biggest issue are always animations as we have before, during, and after to take into account, and that's a lot of possible states and unexpected things to carefully consider).

So that's the context of why we are where we are. Now your use-case seems useful, so I'll keep this ticket open so we can discuss and experiment with it. It may be possible to implement it, so let's see how it goes 👍

ilyabirman commented 3 years ago

Hmm, I disagree with your change of the issue title :–)

To me, it totally makes sense to not engage AltTab during MC, in line with your explanation (however I don’t see a big problem with changing the position of the blue outline either).

I was talking specifically about the Show Desktop mode, rather than the Exposé mode. It didn’t occur to me that Show Desktop was also considered a MC state on some technical level, but from the user experience standpoint it’s very different. So I hope you find it a good idea (and technically viable) to show AltTab when I’m dragging a file from Desktop to some window.

(Your explanations are very eye-opening in that how hard it actually is to implement a good alternative to ⌘Tab and help appreciate your work!)

lwouis commented 3 years ago

I tested to ignore MC and always show AltTab. Some issues I noticed when in "Expose" mode:

These issues don't affect "Show Desktop" mode. In "Show Desktop" mode, I noticed that releasing the shortcut would stop the "Show Desktop" mode if the focused window was on the left or right side of the screen when pushed away. If it was a window pushed to the top side, it would focus it but stay in "Show Desktop" mode.

So, it seems to be a decent experience to enable AltTab in "Show Desktop" mode. Now I don't know of a technique to detect that the OS is in this mode. The current technique to detect MC is pretty rough already, but touches on high-level objects so it works across macOS versions. I'm worried that if we find a trick to detect SD mode, it may be more brittle. In any case, first such a trick needs to be found.

danilagalimov commented 1 year ago

I also face this issue and would like to get it fixed.

Maybe it is possible to do it in the reverse way? For example, to intercept "Show Desktop" command and do the own version of Show Desktop (i.e. by enumerating and hiding all of the windows)?