backgroundapps

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 12 Imported by: 1 module, 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

func RunCommand

func RunCommand(ctx context.Context, argv []string) error

RunCommand runs argv directly, never through a shell, and reports its output with a failure.

Types

type App

type App struct {
	// ID is the app's id, the name of its desktop entry.
	ID string
	// Instance is the Flatpak instance id flatpak kill takes.
	Instance string
	// 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 and each time the monitor comes or goes.

func Follow

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

Follow starts following the background monitor on conn, naming each app with describe and stopping one with run.

func (*Apps) Close

func (a *Apps) Close()

Close stops following.

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 string) error

Stop kills the Flatpak instance with flatpak kill, 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 Run

type Run func(ctx context.Context, argv []string) error

Run runs argv and waits for it.

Jump to

Keyboard shortcuts

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