PrintToVeraeTimeStamp/cmd/verae-print/platform_other.go

46 lines
1,011 B
Go

//go:build !windows
package main
import (
"fmt"
"os"
"os/exec"
"runtime"
"github.com/VeraeLLC/PrintToVeraeTimeStamp/internal/vlog"
)
func notify(title, subtitle string) {
if os.Getenv("VERAE_NO_NOTIFY") == "1" {
return
}
if runtime.GOOS == "linux" {
if os.Getenv("DISPLAY") != "" || os.Getenv("WAYLAND_DISPLAY") != "" {
_ = exec.Command("notify-send", "-a", "Verae Timestamp", "Verae: "+title, subtitle).Run()
}
return
}
if runtime.GOOS != "darwin" {
return
}
script := fmt.Sprintf(`display notification %q with title "Verae Timestamp" subtitle %q`, subtitle, title)
_ = exec.Command("osascript", "-e", script).Run()
}
func notifyUser(title, body string) {
vlog.Printf("notify: %s — %s", title, body)
notify(title, body)
}
func openFolderPath(p string) {
if runtime.GOOS == "darwin" {
_ = exec.Command("open", p).Run()
return
}
_ = exec.Command("xdg-open", p).Start()
}
func runInstallPrinterWindows() int { return 1 }
func debugFromRegistry() bool { return false }