Documentation ¶
Overview ¶
Package beeep provides a cross-platform library for sending desktop notifications and beeps.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultFreq - frequency, in Hz, middle A DefaultFreq = 440.0 // DefaultDuration - duration in milliseconds DefaultDuration = 200 )
var ( // ErrUnsupported is returned when operating system is not supported. ErrUnsupported = errors.New("beeep: unsupported operating system: " + runtime.GOOS) )
Functions ¶
func Alert ¶
Alert displays a desktop notification and plays a beep.
Example ¶
var action [][]string Alert("Title", "MessageBody", "assets/warning.png", action)
Output:
func Beep ¶
Beep beeps the PC speaker (https://en.wikipedia.org/wiki/PC_speaker).
On Linux it needs permission to access `/dev/tty0` or `/dev/input/by-path/platform-pcspkr-event-spkr` files for writing, and `pcspkr` module must be loaded. User must be in correct groups, usually `input` and/or `tty`.
If it can not open device files, it will fallback to sending Bell character (https://en.wikipedia.org/wiki/Bell_character). For bell character in X11 terminals you can enable bell with `xset b on`. For console check `setterm` and `--blength` or `--bfreq` options.
On macOS this just sends bell character. Enable `Audible bell` in Terminal --> Preferences --> Settings --> Advanced.
On Windows it uses Beep function via syscall.
On Web it plays hard coded beep sound.
Example ¶
Beep(DefaultFreq, DefaultDuration)
Output:
Types ¶
This section is empty.