backgroundapps

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 18 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 backgroundapps is the sandboxed apps running without a window, as xdg-desktop-portal's background monitor lists them (built from the portal backend's GetAppState answers), and a way to stop one.

Index

Constants

View Source
const (
	BusName   = "org.freedesktop.background.Monitor"
	Path      = dbus.ObjectPath("/org/freedesktop/background/monitor")
	Interface = "org.freedesktop.background.Monitor"
	// Property is the monitor's aa{sv} list of background apps.
	Property = "BackgroundApps"
)

D-Bus identity of the frontend's background monitor.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// ID is the app's id, the name of its desktop entry.
	ID string
	// Instance is the app's Flatpak instance, which Stop kills.
	Instance InstanceID
	// Message is the status the app set with Background.SetStatus.
	Message string
	// Name and Icon are the desktop entry's display name and Icon=, or
	// the id and "" when no entry matches.
	Name, Icon string
}

App is one sandboxed app running in the background.

type Apps

type Apps struct {
	// contains filtered or unexported fields
}

Apps follows the background monitor on a session bus: the list is read again on each PropertiesChanged of whichever connection owns the monitor's name, and each time the monitor comes or goes.

func Follow

func Follow(conn *dbus.Conn, describe Describe) (*Apps, error)

Follow starts following the background monitor on conn, naming each app with describe.

func (*Apps) Close

func (a *Apps) Close()

Close stops following, once the watch has taken its match rules off the bus.

func (*Apps) List

func (a *Apps) List() []App

List is the apps running in the background now.

func (*Apps) Stop

func (a *Apps) Stop(ctx context.Context, instance InstanceID) error

Stop kills the Flatpak instance as flatpak kill does, then reads the list again.

func (*Apps) Subscribe

func (a *Apps) Subscribe() (<-chan struct{}, func())

Subscribe ticks whenever the list changed.

type Describe

type Describe func(appID string) (name, icon string)

Describe names an app id from its desktop entry.

type InstanceID

type InstanceID struct {
	// contains filtered or unexported fields
}

InstanceID is a Flatpak instance id: a decimal number, the name of the instance's directory under $XDG_RUNTIME_DIR/.flatpak, so it can never be a path separator or "..".

func ParseInstanceID

func ParseInstanceID(s string) (InstanceID, error)

ParseInstanceID validates s as an instance id.

func (InstanceID) String

func (i InstanceID) String() string

String is the id as Flatpak writes it.

Jump to

Keyboard shortcuts

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