lwouis / alt-tab-macos

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

AltTab can't focus another window if Flock.app window is focused #1663

Open alt-tab-macos-bot opened 2 years ago

alt-tab-macos-bot commented 2 years ago

This issue was opened by a bot after a user submitted feedback through the in-app form.

Message:

When Flock messenger is the active window, AltTab is unable to change the window focus to anything else, though regular app switcher works as expected

lwouis commented 2 years ago

I downloaded the mac app, and was able to reproduce the issue.

It seems that _SLPSSetFrontProcessWithOptions doesn't work well with this app. It triggers 2 OS events:

To focus app, we have only the public API: NSApplication.activate but it brings forward the main window, which we don't want. So we are forced to use the private API _SLPSSetFrontProcessWithOptions so avoid that. I also tried __SLPSSetFrontProcessWithOptions and _SLPSSetFrontProcess, but all have the same glitch from Flock.

@koekeishiya any idea why this app would not work well with _SLPSSetFrontProcessWithOptions? I checked again in yabai, and you still focus the same way, with this API. So this app is probably also broken on yabai.

drauziooppenheimer commented 2 years ago

Have the same issue here, but mine's with IntelliJ and Slack, it seems that alt-tab doesn't unfocus/focus them again, causing weird behaviors, such as: files not being updated (IntelliJ) and notifications badge appearing/disappearing instantly (Slack). I'm stuck on version 1.39, since this issue doesn't happen with it. Is there anything I could do to help finding this issue's root cause?

lwouis commented 2 years ago

@drauziooppenheimer not many solutions I'm afraid. We have to use private APIs because Apple doesn't support focusing windows from other Space through any public API. So we are already going beyond what's supposed to be possible, now if it doesn't cover 100%, it's basically retro-engineer and R&D.

Previous discussion: https://github.com/lwouis/alt-tab-macos/issues/922

crabique commented 1 year ago

Could this be fixed with an optional workaround to send the M signal to the application refusing to give up focus? That's what I do manually and it seems to work okay, as the application is getting un-minimized upon selecting it with AltTab.