i3-last-scratchpad/notify/i3.go

25 lines
450 B
Go
Raw Normal View History

2024-09-15 21:48:45 -04:00
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)
}