mirror of
https://github.com/gopasspw/gopass.git
synced 2026-10-07 16:51:40 +02:00
29 lines
489 B
Go
29 lines
489 B
Go
//go:build windows
|
|
|
|
package notify
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/exec"
|
|
|
|
"github.com/gopasspw/gopass/internal/config"
|
|
)
|
|
|
|
// Notify displays a desktop notification through msg
|
|
func Notify(ctx context.Context, subj, msg string) error {
|
|
if os.Getenv("GOPASS_NO_NOTIFY") != "" || !config.Bool(ctx, "core.notifications") {
|
|
return nil
|
|
}
|
|
winmsg, err := exec.LookPath("msg")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return exec.Command(winmsg,
|
|
"*",
|
|
"/TIME:3",
|
|
subj+"\n\n"+msg,
|
|
).Start()
|
|
}
|