25 lines
450 B
Go
25 lines
450 B
Go
package notify
|
|
|
|
import "os/exec"
|
|
|
|
|
|
type i3Urgency string
|
|
|
|
const (
|
|
LowPriority i3Urgency = "low"
|
|
NormalPriority i3Urgency = "normal"
|
|
CriticalPriority i3Urgency = "critical"
|
|
)
|
|
|
|
func SendNotification(msg string, priority i3Urgency) {
|
|
var cmd = exec.Command("notify-send", "-u", string(priority), msg)
|
|
if err := cmd.Start(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func FatalNotification(msg string) {
|
|
SendNotification(msg, CriticalPriority)
|
|
panic(msg)
|
|
}
|