-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
notify_unix.go
33 lines (29 loc) · 847 Bytes
/
notify_unix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//go:build !windows && !darwin
package zenity
import "github.com/ncruces/zenity/internal/zenutil"
func notify(text string, opts options) error {
args := []string{"--notification", "--text", text}
args = appendGeneral(args, opts)
switch opts.icon {
case ErrorIcon:
args = append(args, "--window-icon=dialog-error")
case WarningIcon:
args = append(args, "--window-icon=dialog-warning")
case InfoIcon:
args = append(args, "--window-icon=dialog-information")
case QuestionIcon:
args = append(args, "--window-icon=dialog-question")
case PasswordIcon:
args = append(args, "--window-icon=dialog-password")
case NoIcon:
args = append(args, "--window-icon=")
}
if i, ok := opts.icon.(string); ok {
args = append(args, "--window-icon", i)
}
_, err := zenutil.Run(opts.ctx, args)
if err != nil {
return err
}
return nil
}