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

MacOS Notification: Wrong icon + opens script editor #5100

Open
2 tasks done
tadeaspetak opened this issue Aug 28, 2024 · 4 comments
Open
2 tasks done

MacOS Notification: Wrong icon + opens script editor #5100

tadeaspetak opened this issue Aug 28, 2024 · 4 comments
Labels
not an issue This doesn't seem right

Comments

@tadeaspetak
Copy link

tadeaspetak commented Aug 28, 2024

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

On MacOS, when you send an app notification, the icon doesn't correspond to the icon of the app. Instead, the script editor icon is shown. Clicking the notification doesn't open the app but instead opens the script editor.

This seems to be a regression of this old bug #935 that was solved back in 2020. I tried adding a simple notification e.g. to the GoTune app. Everything works as it should on my machine there. To me, this implies the problem is not related to my version of Go or MacOS but rather to the Fyne version. Or, naturally, it could mean that I'm doing something wrong. But, I tried both the FyneApp.toml approach and setting the icon on the app manually.

How to reproduce

  1. Clone https://github.com/tadeaspetak/fyne-notifications
  2. make to package the app
  3. make run to run the app
  4. click the button

Screenshots

Screenshot 2024-08-28 at 14 16 58

Example code

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.NewWithID("com.tadeaspetak.fyne-notifications")

	w := a.NewWindow("Notification Example")

	button := widget.NewButton("click me", func() {
		a.SendNotification(fyne.NewNotification("Title", "Button clicked."))
	})
	w.SetContent(button)

	w.Resize(fyne.NewSize(200, 200))
	w.ShowAndRun()
}

Fyne version

2.5.1

Go compiler version

1.22.5 darwin/amd64

Operating system and version

Sonoma 14.6.1

Additional Information

No response

@tadeaspetak tadeaspetak added the unverified A bug that has been reported but not verified label Aug 28, 2024
@andydotxyz
Copy link
Member

Apple has changed how notifications work and a Go binary executed in that way is not permitted to send notifications. You have to be a bundled app executed through their launcher.

Instead of "make" or "go run" you should call "fyne install" and then run the app from macOS launcher - you'll see that notifications appear as you would expect.

If you are aware of any workarounds that is great but reading their docs we cannot find any actual API call that is permitted outside of the bundle context.

@andydotxyz andydotxyz added not an issue This doesn't seem right and removed unverified A bug that has been reported but not verified labels Aug 28, 2024
@tadeaspetak
Copy link
Author

tadeaspetak commented Aug 29, 2024

@andydotxyz Thanks a lot of your quick reply! Sadly, this is still not working for me. No matter what I do, I cannot seem to get the correct notification icon & click behaviour.

Could you try cloning the repo and verifying this is the case for you, too?

  1. run fyne install in the repo
  2. open the app from Applications or via the launcher
  3. click the button
  4. see the notification with the script editor icon (instead of the app icon) and incorrect click behaviour

Also, all works fine up to [email protected] and starts being broken at [email protected]. This seems quite natural since that release included PR #1833 which included commit fc94fa.

Screenshot 2024-08-29 at 9 28 21

@tadeaspetak
Copy link
Author

tadeaspetak commented Aug 29, 2024

@andydotxyz Ah, I see the comment below now. In other words, it's not enough to package / install, it also has to be signed, i.e. one needs to have the Apple dev account, certificates, etc., correct?

// this happens if our app was not signed, so do it the old way

@andydotxyz
Copy link
Member

Ahh you're right I forgot that part.
If the app is ready to distribute it will use the system notifications. It used to be that packaging was OK, but not any more :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not an issue This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants