Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix and feat #4164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix and feat #4164

wants to merge 1 commit into from

Conversation

chenxiankong
Copy link

@chenxiankong chenxiankong commented Jan 23, 2025

fix:

  1. fix isOnScreen logic

feat:

  1. filter no normal type screen (For example, the window when creating a meeting in Lark is abnormal)
  2. Optimize the decision logic of similar apps

1. fix isOnScreen logic
feat:
1. filter no normal type screen (For example, the window when creating a meeting in Lark is abnormal)
2. Optimize the decision logic of similar apps
Comment on lines +352 to +360
var isSameApp = false
if let a = window.application.runningApplication.bundleIdentifier{
if let b = NSWorkspace.shared.frontmostApplication?.bundleIdentifier{
if a.contains(b) || b.contains(a) {
isSameApp = true
}
}
}
window.shouldShowTheUser = window.isNormal &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please share why you added this check? Currently we compare the pid of the 2 apps. It seems it's not enough, and you added another check of bundleIds. Could you please share in which cases checking the pids was not working?

To my knowledge, every app has a pid, but not every app has a bundleID. So in that sense, checking pid should be broader, and sufficient.

Copy link
Author

@chenxiankong chenxiankong Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When some apps start windows, they may add a suffix to the bundle.
for example, main app`s bundle is com.bytedance.lark
if lark start a video chat window, the bundle may be com.bytedance.lark.video
these code want to fix it

you can use lark(https://www.larksuite.com/) and start a meeting window and test it

@@ -36,10 +39,13 @@ class Window {
]

init(_ axUiElement: AXUIElement, _ application: Application, _ wid: CGWindowID, _ axTitle: String?, _ isFullscreen: Bool, _ isMinimized: Bool, _ position: CGPoint?, _ size: CGSize?) {
let subRole = try? axUiElement.subrole()
self.isNormal = subRole == "AXStandardWindow"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We alread check this in the isActualWindow method, which is used before calling this constructor. So I think rechecking here is not necessary.

Perhaps you saw something that I'm missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method(isActualWindow) is not perfect, so use lark to open a metting window. There will be a forced front
and small meeting window in the upper right corner. It is meaningless to switch to this window.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isActualWindow checks if the window is reasonable to list in our switcher. It should be either a standard-window, or a dialog. It should have a title, a size bigger than a minimum size, etc.

Some apps are incorrectly coded, and they will end up having their windows either show up when they should't show up, or not show when they should show.

We've hard-coded some exceptions over the years. These days I don't want to hard-code any exception. It's on the broken apps to fix themselves. It's not on AltTab to add magic code to repair specific apps. Furthermore, these apps change quickly, so our workarounds may break things later.

It's definitely on the broken apps to fix themselves. Their broken code affects AltTab and it also affects other accessibility apps.

Here this lark is most likely having an issue. I suggest you report it to their support, so they get it fixed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact is that lark does not adapt to this software, but as a developer, I can understand your considerations. I accept it.

@lwouis
Copy link
Owner

lwouis commented Jan 25, 2025

Hi @chenxiankong,

I've looked into your PR, and made a few changes. Could you please test this local build, and let me know if it handles every case correctly for you, regarding the original issue?

Thank you

@lwouis
Copy link
Owner

lwouis commented Feb 3, 2025

Hi @chenxiankong,
Any chance you could look at my previous message?
Thank you 🙇

@chenxiankong
Copy link
Author

Hi @chenxiankong,

I've looked into your PR, and made a few changes. Could you please test this local build, and let me know if it handles every case correctly for you, regarding the original issue?

Thank you

hi @lwouis
it fix !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants