gen2brain / beeep

Go cross-platform library for sending desktop notifications, alerts and beeps
BSD 2-Clause "Simplified" License
1.43k stars 89 forks source link

Clicking the notification opens AppleScript editor #35

Open advdv opened 4 years ago

advdv commented 4 years ago

As the title says, with the example like :

package main

import (
    "github.com/gen2brain/beeep"
)

func main() {

    err := beeep.Notify("Title", "Message body", "")
    if err != nil {
        panic(err)
    }

    select {}
}

When the notification is clicked it will open the AppleScript editor. This seems to be a side effect from using the applescript approach: https://discussions.apple.com/thread/6449168

This issue is pretty old so maybe a solution was become available in the meantime?

gen2brain commented 4 years ago

Not sure, I don't use macOS and so cannot follow the changes there, I just sometimes use VM for testing. I think the only possible solution (without CGO) is to use Applescript, suggestions, and PRs are welcome.

advdv commented 4 years ago

Thank you for the response. I've searched around but there doesn't seem to be a fix for this and is intrinsic to the use of applescript for notifications. Maybe a warning in the Readme or leave this issue open for others to find?

Since the keybase's library also has issues (https://github.com/keybase/go-notifier/issues) I think the 2MB binary embed approach of https://github.com/deckarep/gosx-notifier is currently the only solution that provides a complete user experience on macOS. Unfortunately, but i'm happy to be proven wrong and help with testing of any alternatives.

gen2brain commented 4 years ago

There were already suggestions to use embedded binaries, but I don't like that approach. This lib doesn't try to offer complete experience on all OSes but tries to just work everywhere. In this case, IMO if there is no support for notifications actions in applescript, but default is to open script editor, issue should be filed there maybe? That doesn't seem to be reasonable default, but there is no public tracker there, or I cannot find it.