stash/pkg/desktop/desktop_platform_linux.go
kermieisinthehouse 0e514183a7
Desktop integration (#2073)
* Open stash in system tray on Windows/MacOS
* Add desktop notifications
* MacOS Bundling
* Add binary icon

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2022-02-03 11:20:34 +11:00

43 lines
888 B
Go

//go:build linux
// +build linux
package desktop
import (
"io/ioutil"
"os"
"os/exec"
"strings"
"github.com/stashapp/stash/pkg/logger"
)
// isService checks if started by init, e.g. stash is a *nix systemd service
func isService() bool {
return os.Getppid() == 1
}
func isServerDockerized() bool {
_, dockerEnvErr := os.Stat("/.dockerenv")
cgroups, _ := ioutil.ReadFile("/proc/self/cgroup")
if !os.IsNotExist(dockerEnvErr) || strings.Contains(string(cgroups), "docker") {
return true
}
return false
}
func hideExecShell(cmd *exec.Cmd) {
}
func sendNotification(notificationTitle string, notificationText string) {
err := exec.Command("notify-send", "-i", getIconPath(), notificationTitle, notificationText, "-a", "Stash").Run()
if err != nil {
logger.Errorf("Error sending notification on Linux: %s", err.Error())
}
}
func revealInFileManager(path string) {
}