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: Setting window fails to appear front #383

Merged
merged 5 commits into from
Feb 4, 2024

Conversation

phlpsong
Copy link
Collaborator

@phlpsong phlpsong commented Feb 3, 2024

#382

Introduce one new package: https://github.com/orchetect/SettingsAccess

This workaround does nothing if running from Xcode, but running as a standalone app it will work according to doc.

But it seems to work well both from Xcode build or archive based on my test.

@CanglongCl
Copy link
Collaborator

CanglongCl commented Feb 3, 2024

Is it fixed in macOS 13.0? It seems only affect macOS 14.0+.

@phlpsong
Copy link
Collaborator Author

phlpsong commented Feb 3, 2024

Is it fixed in macOS 13.0? It seems only affect macOS 14.0+.

Yes, I thought it only affects on macOS 14.0+ using SettingLink.

I think NSApp.activate(ignoringOtherApps: true) should work on macOS 13 too, could you have a try if you're using macOS 13?

@CanglongCl
Copy link
Collaborator

Is it fixed in macOS 13.0? It seems only affect macOS 14.0+.

Yes, I thought it only affects on macOS 14.0+ using SettingLink.

I think NSApp.activate(ignoringOtherApps: true) should work on macOS 13 too, could you have a try if you're using macOS 13?

I do not use macOS 13 currently. Any other one can help?

@Jerry23011
Copy link
Collaborator

I can setup a virtual machine later

I'll check the release mode only since it's too complicated to set up Xcode from gound up.

@Jerry23011
Copy link
Collaborator

The issue still exists on macOS 13

I tested it on a macOS 13.6 VM

macOS.13.6.mov

The workaround is working on a macOS 14.4 beta 1 VM, I can see there's a workaround going, but it's pretty stable.

macOS.14.4.beta.1.mov

@phlpsong
Copy link
Collaborator Author

phlpsong commented Feb 3, 2024

The issue still exists on macOS 13

I tested it on a macOS 13.6 VM

macOS.13.6.mov
The workaround is working on a macOS 14.4 beta 1 VM, I can see there's a workaround going, but it's pretty stable.

macOS.14.4.beta.1.mov

I just push a new commit to apply NSApp.activate(ignoringOtherApps: true) below macOS 14.

Could u give it a try?

@Jerry23011
Copy link
Collaborator

Yep! Now it works on 13.6

Jerry23011
Jerry23011 previously approved these changes Feb 3, 2024
@phlpsong
Copy link
Collaborator Author

phlpsong commented Feb 3, 2024

Yep! Now it works on 13.6

Much appreciated!

CanglongCl
CanglongCl previously approved these changes Feb 3, 2024
@tisfeng
Copy link
Owner

tisfeng commented Feb 3, 2024

I tested this code, it works.

So, is this a bug in the use of SettingsLink in SwiftUI? 🤔

@phlpsong
Copy link
Collaborator Author

phlpsong commented Feb 4, 2024

I tested this code, it works.

So, is this a bug in the use of SettingsLink in SwiftUI? 🤔

It can be said that Apple does not provide extra interfaces for SettingsLink to let us control the activation of window.

@tisfeng
Copy link
Owner

tisfeng commented Feb 4, 2024

Oh, I see.

@phlpsong phlpsong dismissed stale reviews from Jerry23011 and CanglongCl via 449d1e6 February 4, 2024 03:05
@tisfeng tisfeng merged commit 4b2cfb1 into tisfeng:dev Feb 4, 2024
5 checks passed
@phlpsong phlpsong deleted the setting_fail_appear_front branch February 4, 2024 07:32
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.

5 participants