desktopcopy

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package desktopcopy recognises a zn executable that ZenNotes desktop placed and manages itself.

On macOS and Linux desktop runs zn through a shell launcher that exports ZENNOTES_WORKSPACE_SOURCE=app and ZENNOTES_APP_PATH. Windows has no such launcher: desktop puts a real zn.exe in a folder it owns and writes a sidecar file beside it,

zn.desktop.json   {"schemaVersion":1,"appPath":"C:\\...\\ZenNotes.exe"}

which tells this copy of zn that it belongs to the app. Development builds of desktop leave appPath out; schemaVersion 1 alone is enough. The check is the same on every platform, so desktop may use it anywhere.

Index

Constants

View Source
const FileName = "zn.desktop.json"

FileName is the sidecar's name, next to the executable.

Variables

This section is empty.

Functions

func ApplyEnv

func ApplyEnv() bool

ApplyEnv gives a desktop-managed copy the environment desktop's launcher gives it elsewhere: ZENNOTES_WORKSPACE_SOURCE=app and, when the sidecar names the app, ZENNOTES_APP_PATH, each only when it is unset or empty, as the launcher's `${VAR:=value}` does. It reports whether a sidecar was found.

Types

type Sidecar

type Sidecar struct {
	// AppPath is the absolute path to the ZenNotes desktop executable, or ""
	// when the sidecar has none (development builds of desktop omit it).
	AppPath string
}

Sidecar is the parsed zn.desktop.json.

func Read

func Read(executable string) (Sidecar, bool)

Read returns the sidecar beside executable. Any problem (no file, not a regular file, too large, written by someone else, not JSON, an unknown schemaVersion, an appPath that is present but not an absolute path) reports false: a malformed or untrusted sidecar is ignored, never an error, so it cannot stop zn from running.

func Running

func Running() (Sidecar, bool)

Running reads the sidecar beside the running executable, after resolving symlinks, so a link to the desktop's copy counts and the sidecar is looked for next to the real file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL