2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-18 15:25:31 +00:00
cointop/vendor/github.com/gen2brain/beeep/alert_darwin.go

17 lines
467 B
Go
Raw Normal View History

2020-12-21 06:05:14 +00:00
// +build darwin,!linux,!freebsd,!netbsd,!openbsd,!windows,!js
package beeep
import "os/exec"
// Alert displays a desktop notification and plays a default system sound.
func Alert(title, message, appIcon string) error {
osa, err := exec.LookPath("osascript")
if err != nil {
return err
}
cmd := exec.Command(osa, "-e", `tell application "System Events" to display notification "`+message+`" with title "`+title+`" sound name "default"`)
return cmd.Run()
}