desktop_toast.go 393 B

123456789101112131415161718
  1. //go:build !darwin
  2. package notifications
  3. import "github.com/gen2brain/beeep"
  4. func sendDesktopNotification(title string, body string, image string, playSound bool, duration int) error {
  5. beeep.DefaultDuration = duration
  6. if err := beeep.Notify(title, body, image); err != nil {
  7. return err
  8. }
  9. if playSound {
  10. return beeep.Beep(beeep.DefaultFreq, beeep.DefaultDuration)
  11. }
  12. return nil
  13. }