Replies: 2 comments
-
Did you try: func main() {
app := cocoa.NSApp_WithDidLaunch(func(notification objc.Object) {
config := webkit.WKWebViewConfiguration_New()
.......
app.Terminate()
})
app.SetActivationPolicy(cocoa.NSApplicationActivationPolicyRegular)
app.ActivateIgnoringOtherApps(true)
app.Run()
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
I don't think I noticed you wanted to continue the program after |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do I go about stopping an app programmatically once its Run() method is called?
For example,
Calling app.Terminate() won't have an effect after the Run() call. What's the best way to achieve it?
Some context on why I need to do this. I have a legacy Go-written app which has a menubar icon. It uses defaults AppleInterfaceSyle to determine menubar color (dark or light) - which doesn't work post- Big Sur operating systems. I'm using Macdriver to create a button and check for EffectiveAppearance to get an indication of if the menubar is light or dark. As far as I know this is the only method to test this when the menubar is auto-rendered dark/light based on background wallpaper color. Ref: https://stackoverflow.com/questions/62685948/macos-big-sur-detect-dark-menu-bar-system-tray
Once I run the app and detect the color I'd like to quit the app and continue on with the rest of the main.go
Beta Was this translation helpful? Give feedback.
All reactions