summary refs log blame commit diff stats
path: root/notification/notify_darwin.go
blob: bddaf9ea3aa77645314f1c6a758908d545f7c575 (plain) (tree)
























                                                                                                             
// +build darwin

package notification

import (
	"fmt"
	"os/exec"
	"strconv"
)

// Notify sends a desktop notification to the user using osascript. It
// handles information in the form of Notif struct. It returns an
// error (if exists).
func (n Notif) Notify() error {
	// This script cuts out parts of notification, this bug was
	// confirmed on macOS Catalina 10.15.3, fix not yet known.
	err := exec.Command("osascript", "-e",
		`display notification `+strconv.Quote(n.Message)+` with title `+strconv.Quote(n.Title)).Run()
	if err != nil {
		err = fmt.Errorf("%s\n%s",
			"notify_darwin.go: failed to sent notification with osascript",
			err.Error())
	}
	return err
}
can also use your own functions. * Change the file type => application associations: In ranger/defaults/apps.py modify the method app_default. The variable "f" is a filesystem-object with attributes like mimetype, extension, etc. For a full list, check ranger/fsobject/fsobject.py * Change the file extension => mime type associations: Modify ranger/data/mime.types Version Numbering ----------------- X.Y.Z, where: * X: Major version, milestone * Y: Minor version, even number => stable version * Z: Revision, may be omitted if zero