flatpak

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 7 Imported by: 4 modules, 3 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 flatpak detects a Flatpak sandbox and runs commands on the host from inside one. The sandbox cannot see the host's programs, processes or autostart folder, so a command reaches them through flatpak-spawn, which needs the org.freedesktop.Flatpak bus name (--talk-name=org.freedesktop.Flatpak) in the app's finish-args.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(ctx context.Context, name string, args ...string) *exec.Cmd

Command returns the Cmd that runs name on the host: flatpak-spawn --host inside a Flatpak, name itself outside. Inside, the Cmd is flatpak-spawn's, so Dir and Env set on it do not reach the host program; use HostArgv for those. It is built with CommandContext.

func CommandContext

func CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd

CommandContext is exec.CommandContext, except that for name "flatpak-spawn" a cancel sends SIGTERM and WaitDelay is 5 s. flatpak-spawn forwards SIGTERM to the host child but cannot forward the SIGKILL Go sends by default, which would leave the child running.

func HostArgv

func HostArgv(dir string, env []string, name string, args ...string) (string, []string)

HostArgv returns the flatpak-spawn command line that runs name on the host, in dir when non-empty, with env added. Pure: callers that start the process themselves (with their own pipes, process group, context) use it.

func HostLookPath

func HostLookPath(ctx context.Context, name string) (string, error)

HostLookPath finds name on the host's PATH, or returns exec.ErrNotFound. It asks the host's sh rather than which, which minimal hosts do not install. It always spawns flatpak-spawn, so call it only inside a Flatpak.

func Inside

func Inside() bool

Inside reports whether the process runs in a Flatpak sandbox (FLATPAK_ID is set).

Types

This section is empty.

Jump to

Keyboard shortcuts

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