Documentation
¶
Overview ¶
Package desktop starts programs, opens URLs, uses the clipboard and finds per-user directories the way the current desktop platform expects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
Copy puts text on the clipboard, waiting for the clipboard tool to finish. It tries each installed tool in turn until one succeeds, as a tool can be installed but unusable, such as wl-copy in an X11 session.
func DataDir ¶
DataDir returns the default directory for user-specific data files. Callers should create their own subdirectory within it. It need not exist yet.
On Linux and BSD it is $XDG_DATA_HOME, or ~/.local/share if that is unset or relative. On macOS it is ~/Library/Application Support, and on Windows %AppData%.
func Launch ¶
Launch starts a program detached from this one, in its own session (or process group on Windows) with no standard input or output, and returns without waiting for it. The program is reaped in the background once it exits, so it never lingers as a zombie.
func Open ¶
Open opens a URL or file with the desktop's default handler, started the same detached way as Launch. It refuses a url starting with "-", which the handler would take as an option; pass a file named that way as "./-name".
func RuntimeDir ¶
RuntimeDir returns the default directory for user-specific runtime files such as sockets and pipes. Callers should create their own subdirectory within it.
On Linux and BSD it is $XDG_RUNTIME_DIR, and an error if that is unset or relative as there is no safe default. On macOS and Windows it is os.TempDir.
func StateDir ¶
StateDir returns the default directory for user-specific state that should persist but isn't worth backing up, such as logs and history. Callers should create their own subdirectory within it. It need not exist yet.
On Linux and BSD it is $XDG_STATE_HOME, or ~/.local/state if that is unset or relative. On macOS it is ~/Library/Application Support, and on Windows %LocalAppData%.
Types ¶
This section is empty.