Documentation
¶
Overview ¶
Package service registers the daemon with the OS so it starts at login: a launchd agent on macOS, a systemd user unit on Linux.
Index ¶
- Variables
- func File() string
- func HasDisplay(pid int) (has, known bool)
- func Install(configPath string) error
- func Journaled() bool
- func LingerOff() bool
- func LingerOn() bool
- func MenuBarAppStartsDaemon() bool
- func MissingDisplay() bool
- func NoSystemdHint() string
- func Owns(configPath string) bool
- func OwnsState() bool
- func Restart() error
- func Start() error
- func Supported() bool
- func Uninstall() error
- func Unit() string
- type Status
Constants ¶
This section is empty.
Variables ¶
var ErrNoSystemd = errors.New("this system does not run systemd")
ErrNoSystemd means this Linux system does not run systemd, so there is no user service manager to register the daemon with.
Functions ¶
func HasDisplay ¶ added in v0.6.1
HasDisplay reports whether process pid runs with a DISPLAY or WAYLAND_DISPLAY (Linux), which desktop notifications need; known is false when its environment cannot be read.
func Install ¶
Install writes the service definition and starts it. On Linux without systemd it returns ErrNoSystemd.
func Journaled ¶ added in v0.6.0
func Journaled() bool
Journaled reports whether the daemon of this state directory is systemd's to run, so its output is in the user journal: the unit is installed for this state directory and not stopped (running, starting or failed, so the output of a start that failed is found too).
func LingerOff ¶
func LingerOff() bool
LingerOff reports whether systemd ends the account's user services at logout (Linux only), so the daemon neither outlives a session nor starts at boot. It is false when this cannot be determined.
func LingerOn ¶ added in v0.6.0
func LingerOn() bool
LingerOn reports whether systemd keeps the account's user services running without a session and starts them at boot (Linux only).
func MenuBarAppStartsDaemon ¶
func MenuBarAppStartsDaemon() bool
MenuBarAppStartsDaemon reports whether the macOS menu bar app opens at login, which starts the daemon too. The app records that setting in its preferences.
func MissingDisplay ¶
func MissingDisplay() bool
MissingDisplay reports, on Linux, whether this process runs in a desktop session (a local DISPLAY or a WAYLAND_DISPLAY) while the running service's daemon has neither, so it cannot show notifications or open windows.
func NoSystemdHint ¶
func NoSystemdHint() string
NoSystemdHint explains how to start the daemon at login without systemd.
func Owns ¶
Owns reports whether the installed service runs the daemon for configPath with this process's state directory and the configured port, so starting the service starts the daemon that a client with these settings talks to. A service installed before it pinned the state directory runs with the default one.
func OwnsState ¶ added in v0.6.3
func OwnsState() bool
OwnsState reports whether the installed service runs the daemon of this process's state directory. A service installed before it pinned the state directory runs with the default one.
func Restart ¶
func Restart() error
Restart stops the service's daemon, if it runs, and starts it again.