-
-
Notifications
You must be signed in to change notification settings - Fork 158
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 #32 - MacOS crash when Desktop becomes the active window #39
Conversation
@sindresorhus Good to merge? |
im having this issue too, hoping this fixes it |
@tiangolo @sindresorhus - are you able to review and merge, please? |
Sources/active-win/main.swift
Outdated
"bundleId": app.bundleIdentifier!, | ||
"path": app.bundleURL!.path | ||
] | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with this solution, you have to fill out all the fields.
I think a better solution would be to admit that there can't always be an active window, and return null in such scenarios. |
If we return null it would be a (more) breaking change than this PR. But I don’t mind. |
I'm ok with that. |
i also think returning null is fine, its easy enough to modify code to check if null watever happens, as long as it doesnt break if you are lookin at the desktop on macOS im happy ;) |
…which is what is happening inside lib/macos.js, but is not directly testable.
Updated to return null. Works locally when calling |
@sindresorhus Good to merge? |
Btw, I've just created a tool called |
@uglow Cool use-case. You should do a PR to add it to the readm here. Under a new "Users" section or something ;) |
Fixes #32.
The Desktop window does not appear in the
window
collection because of theexcludeDesktopElements
flag - which is reasonable as you probably don't want icons and the System menu showing up in the results. However, this causes the crash that was identified in issue #32.This PR prevents the system from crashing out when the active window is not in the
window
collection by return a "fake" Desktop result.