Documentation
¶
Overview ¶
Package beeep provides a cross-platform library for sending desktop notifications and beeps.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultFreq - frequency, in Hz, middle A DefaultFreq = 0.0 // DefaultDuration - duration in milliseconds DefaultDuration = 0 )
View Source
var AppName = "DefaultAppName"
AppName is the name of app. This should be the application's formal name, rather than some sort of ID.
View Source
var ( // ErrUnsupported is returned when an operating system is not supported. ErrUnsupported = fmt.Errorf("beeep: unsupported operating system: %s", runtime.GOOS) )
Functions ¶
func Alert ¶
Alert displays a desktop notification and plays a beep.
Example ¶
package main
import (
_ "embed"
"github.com/gen2brain/beeep"
)
func main() {
beeep.AppName = "My App Name" // change the default app name
_ = beeep.Alert("Title", "MessageBody", "testdata/warning.png")
}
Output:
func Beep ¶
Beep beeps the PC speaker (https://en.wikipedia.org/wiki/PC_speaker).
Example ¶
package main
import (
_ "embed"
"github.com/gen2brain/beeep"
)
func main() {
_ = beeep.Beep(beeep.DefaultFreq, beeep.DefaultDuration)
}
Output:
func Notify ¶
Notify sends desktop notification.
On the Web, in Firefox it just works, in Chrome you must call it from some "user gesture" like `onclick`, and you must use TLS certificate, it doesn't work with plain http.
Example ¶
package main
import (
_ "embed"
"github.com/gen2brain/beeep"
)
//go:embed testdata/info.png
var icon []byte
func main() {
_ = beeep.Notify("Title", "MessageBody", icon) // icon is embedded file
}
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.