autostart

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: ? 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 autostart starts a program at sign-in, or stops doing so. Linux writes an XDG autostart desktop entry under the config home, or asks the Background portal inside a Flatpak. Windows sets a HKCU Run value. Elsewhere Enable, Disable and Enabled return ErrUnsupported.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("autostart: unsupported")

ErrUnsupported is returned by Enable, Disable and Enabled on a platform that has no start-at-sign-in mechanism here.

Functions

func Disable

func Disable(ctx context.Context, id string) error

Disable removes the start-at-sign-in entry id.

func Enable

func Enable(ctx context.Context, e Entry) error

Enable arranges for e.Argv to run at sign-in. Inside a Flatpak it asks the Background portal; otherwise it writes e.ID.desktop in the XDG autostart folder. ctx bounds the portal's consent dialog.

func Enabled

func Enabled(id string) (bool, error)

Enabled reports whether the start-at-sign-in entry id exists in the XDG autostart folder. Inside a Flatpak the portal's entry is outside the sandbox's view, so Enabled reports false there; keep the choice yourself.

Types

type Entry added in v0.9.0

type Entry struct {
	// ID names the entry: the desktop file's stem on Linux, the Run value's name on Windows. Disable and Enabled take it.
	ID string
	// Name is what the session's list of startup programs shows; empty shows ID.
	Name string
	// Reason is shown in the Flatpak Background portal's permission dialog; empty sends none.
	Reason string
	// Argv is the command the session runs at sign-in, or inside a Flatpak the command the portal starts in the sandbox.
	Argv []string
}

Entry is one program started at sign-in.

Jump to

Keyboard shortcuts

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