Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,14 @@ prep command that exits abnormally to a desktop notifier. Since modd commands
are shell scripts, you can redirect or manipulate output to entirely customise
what gets sent to notifiers as needed.

At the moment, we support [Growl](http://growl.info/) on OSX, and
At the moment, we support [terminal-notifier](https://github.com/julienXX/terminal-notifier) and [Growl](http://growl.info/) on OSX, and
[libnotify](https://launchpad.net/ubuntu/+source/libnotify) on Linux and other
Unix systems.

## terminal-notifier

terminal-notifier is a command-line tool to send macOS User Notifications, which are available on macOS 10.10 and higher. Follow the instructions in the [terminal-notifier GitHub repository](https://github.com/julienXX/terminal-notifier) to install.

## Growl

For Growl to work, you will need Growl itself to be running, and have the
Expand Down
16 changes: 15 additions & 1 deletion notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ func (GrowlNotifier) Push(title string, text string, iconPath string) {
go cmd.Run()
}

// TerminalNotifier is a notifier for terminal-notifier
type TerminalNotifier struct {
}

// Push implements Notifier
func (TerminalNotifier) Push(title string, text string, iconPath string) {
cmd := exec.Command(
"terminal-notifier", "-title", prog, "-subtitle", title, "-message", text,
)
go cmd.Run()
}

// LibnotifyNotifier is a notifier for lib-notify
type LibnotifyNotifier struct {
}
Expand All @@ -54,7 +66,9 @@ func (LibnotifyNotifier) Push(title string, text string, iconPath string) {

// PlatformNotifier finds a notifier for this platform
func PlatformNotifier() Notifier {
if hasExecutable("growlnotify") {
if hasExecutable("terminal-notifier") {
return &TerminalNotifier{}
} else if hasExecutable("growlnotify") {
return &GrowlNotifier{}
} else if hasExecutable("notify-send") {
return &LibnotifyNotifier{}
Expand Down