-
Notifications
You must be signed in to change notification settings - Fork 3
/
darwin.go
45 lines (41 loc) · 938 Bytes
/
darwin.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
34
35
36
37
38
39
40
41
42
43
44
45
// +build darwin
package growl
import "os"
func getCmd() Command {
var c Command
if _, err := Which("terminal-notifier"); err == nil {
c = Command{
Type: "Darwin-NotificationCenter",
Pkg: "terminal-notifier",
Msg: "-message",
Title: "-title",
Subtitle: "-subtitle",
Sound: "-sound",
Url: "-open",
Priority: &Priority{
Cmd: "-execute",
Range: []string{},
},
}
} else {
c = Command{
Type: "Darwin-Growl",
Pkg: "growlnotify",
Msg: "-m",
Sticky: "--sticky",
Priority: &Priority{
Cmd: "--priority",
Range: []string{"-2", "-1", "0", "1", "2", "Very Low", "Moderate", "Normal", "High", "Emergency"},
},
}
}
var activate string
terminal := os.Getenv("TERM_PROGRAM")
if terminal == "iTerm.app" {
activate = "com.googlecode.iterm2"
} else {
activate = "com.apple.Terminal"
}
c.Activate = "-activate " + activate
return c
}