lwouis / alt-tab-macos

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

Feishu app keeps focus after switching to another window #852

Closed alt-tab-macos-bot closed 3 years ago

alt-tab-macos-bot commented 3 years ago

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

From: 574273435@qq.com

Message:

When using feishu(https://www.feishu.cn/download), altTab can't change window normally. For example, open 3 windows, window A, window B and feishu. Change to feishu, then B, then A, then feishu, then A, this step will fail, feishu will stay at the front of the screen.

Debug profile

* App version: 6.17.0 * App preferences: * MSAppCenter310AppCenterUserDefaultsMigratedKey: 1 * MSAppCenter310CrashesUserDefaultsMigratedKey: 1 * MSAppCenterInstallId: 9FA972DA-0989-4C25-A84F-FD87DDB42F75 * MSAppCenterPastDevices: {length = 1132, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 0000037a } * MSAppCenterSessionIdHistory: {length = 452, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 0000014e } * MSAppCenterUserIdHistory: {length = 447, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 00000149 } * NSWindow Frame SUAutomaticUpdateAlert: 652 656 616 180 0 0 1920 1055 * NSWindow Frame SUUpdateAlert: 650 497 620 392 0 0 1920 1055 * NSWindow Frame com.sindresorhus.Preferences.FrameAutosaveName: 714 259 491 577 0 0 1920 1057 * SUAutomaticallyUpdate: 1 * SUEnableAutomaticChecks: 1 * SUHasLaunchedBefore: 1 * SULastCheckTime: 2021-03-01 13:57:47 +0000 * SUUpdateGroupIdentifier: 2652446248 * SUUpdateRelaunchingMarker: 0 * alignThumbnails: 1 * appsToShow: 0 * crashPolicy: 2 * fadeOutAnimation: false * hideAppBadges: false * hideColoredCircles: true * hideSpaceNumberLabels: false * hideStatusIcons: false * hideThumbnails: false * hideWindowlessApps: false * holdShortcut: ⌘ * maxCellsPerRow: 7 * maxHeightOnScreen: 70 * maxScreenUsage: 70 * maxWidthOnScreen: 70 * menubarIcon: 2 * minCellsPerRow: 5 * mouseHoverEnabled: false * nextWindowShortcut: ⇥ * preferencesVersion: 6.17.0 * screensToShow: 0 * showOnScreen: 2 * showTabsAsWindows: false * spacesToShow: 0 * startAtLogin: false * theme: 1 * titleTruncation: 0 * updatePolicy: 2 * windowMaxWidthInRow: 30 * Applications: 50 * Windows: 13 * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 1, spaceIndex: 1} * OS version: 版本10.16(版号20C69) * OS architecture: x86_64 * Locale: zh_CN (current) * Spaces: 2 * Dark mode: Light * "Displays have separate Spaces": checked * Hardware model: MacBookPro16,1 * Screens: 1 * {x: 0.0, y: 0.0, width: 1920.0, height: 1080.0} * CPU model: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz * Memory size: 17.18 GB * Active CPU count: 12 * Current CPU frequency: 2.6 Ghz * Resource utilization: * CPU: 0.0% * Memory: 80M- * Threads count: 10

lwouis commented 3 years ago

I was able to reproduce!

We had a ticket in the past (https://github.com/lwouis/alt-tab-macos/issues/836) but I couldn't understand. But this time I understood it's not about an issue not showing windows, it's an issue where while Feishu is focused, it's impossible to focus back to another app using AltTab.

Reproduction steps:

lwouis commented 3 years ago

The issue seems to be that the private API _SLPSSetFrontProcessWithOptions doesn't remove key focus from the currently focused window (only for Feishu for some reason). This means that both the Feishu window and the next focused window appear to have key focus. Yet only the newly focused window has it really. Seems like an artifact of using this private API. It must not be cleaning some internal state properly, compared to using NSRunningApplication.activate.

Now the reason we use this private API in the first place is because NSRunningApplication.activate doesn't let us focus a window on another Space.

I think the way to move forward with this issue is to implement https://github.com/lwouis/alt-tab-macos/issues/447

lwouis commented 3 years ago

@wrdcz this is Github. You can use Github notifications, receive emails from github, come to the page every day. It's up to you. This website is a community website like a forum. This is not customer service from a commercial company. There is no deadline and guarantees. This project is mainly volunteer work from me, on my weekends.

lwouis commented 3 years ago

I spent many hours today trying to use the technique of invisible windows discussed in #447, to avoid having to use private APIs to focus other-Space windows.

I can't beat the current implementation. Focusing an invisible window works for switching to another Space. That's pretty cool. However, it doesn't handle 1 use-case that the private APIs currently do:

This is because we need to activate the app to give it key focus, but when we do, the latest key window gets activated as well.

I tried a million combinations of all 6 or 7 APIs involved, in different orders. I can't find a way to make it work as nicely as the current implementation.

Since the current implementation works for every app except Feishu, that's another incentive not to change it also.

I'll mark this as Need breakthrough

lwouis commented 3 years ago

Closing in favor of https://github.com/lwouis/alt-tab-macos/issues/922 where the overarching issue can be addressed

heytentt commented 3 years ago

Feishu has fixed this issue since V3.47.0

If anyone has the same problem, please upgrade Feishu.