linuxbase

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SIGTERMTimeout is how long to wait for graceful SIGTERM shutdown.
	SIGTERMTimeout = 3 * time.Second
	// SIGKILLTimeout is how long to wait after SIGKILL before proceeding.
	SIGKILLTimeout = 500 * time.Millisecond
)

Timeout constants for process termination.

Variables

This section is empty.

Functions

func Settings

func Settings() platforms.Settings

Settings returns XDG-based settings for Linux platforms.

func SupportedReaders

func SupportedReaders(cfg *config.Instance, p platforms.Platform) []readers.Reader

SupportedReaders returns the list of enabled readers for Linux platforms. The platform parameter is needed for tty2oled reader initialization.

Types

type Base

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

Base provides common functionality for all Linux-family platforms. Platforms embed this struct and override methods as needed.

func NewBase

func NewBase(platformID string) *Base

NewBase creates a new Base with the given platform ID.

func (*Base) ConsoleManager

func (*Base) ConsoleManager() platforms.ConsoleManager

ConsoleManager returns a no-op console manager.

func (*Base) ForwardCmd

func (*Base) ForwardCmd(_ *platforms.CmdEnv) (platforms.CmdResult, error)

ForwardCmd returns an empty result (no command forwarding on Linux platforms).

func (*Base) GamepadPress

func (*Base) GamepadPress(_ string) error

GamepadPress is a no-op for Linux platforms.

func (*Base) ID

func (b *Base) ID() string

ID returns the platform identifier.

func (*Base) KeyboardPress

func (*Base) KeyboardPress(_ string) error

KeyboardPress is a no-op for Linux platforms.

func (*Base) LaunchMedia

func (b *Base) LaunchMedia(
	cfg *config.Instance,
	path string,
	launcher *platforms.Launcher,
	db *database.Database,
	opts *platforms.LaunchOptions,
	p platforms.Platform,
) error

LaunchMedia launches media using the appropriate launcher. The platform parameter is required to access the platform's Launchers method (struct embedding means Base cannot call methods defined on the outer type).

func (*Base) LaunchSystem

func (*Base) LaunchSystem(_ *config.Instance, _ string) error

LaunchSystem returns an error as launching systems is not supported.

func (*Base) LookupMapping

func (*Base) LookupMapping(_ *tokens.Token) (string, bool)

LookupMapping returns false (no token mappings on Linux platforms).

func (*Base) ReturnToMenu

func (*Base) ReturnToMenu() error

ReturnToMenu is a no-op for the base Linux implementation. Platforms with a menu concept (like SteamOS) should override this method.

func (*Base) RootDirs

func (*Base) RootDirs(cfg *config.Instance) []string

RootDirs returns the configured index roots.

func (*Base) ScanHook

func (*Base) ScanHook(_ *tokens.Token) error

ScanHook is a no-op for Linux platforms.

func (*Base) SetClock

func (b *Base) SetClock(clock clockwork.Clock)

SetClock sets the clock for testing. Must be called before using the Base.

func (*Base) SetTrackedProcess

func (b *Base) SetTrackedProcess(proc *os.Process)

SetTrackedProcess stores a process handle, killing any existing tracked process.

func (*Base) ShowLoader

func (*Base) ShowLoader(
	_ *config.Instance,
	_ widgetmodels.NoticeArgs,
) (func() error, error)

ShowLoader returns ErrNotSupported (no UI widgets on Linux platforms).

func (*Base) ShowNotice

func (*Base) ShowNotice(
	_ *config.Instance,
	_ widgetmodels.NoticeArgs,
) (func() error, time.Duration, error)

ShowNotice returns ErrNotSupported (no UI widgets on Linux platforms).

func (*Base) ShowPicker

func (*Base) ShowPicker(
	_ *config.Instance,
	_ widgetmodels.PickerArgs,
) error

ShowPicker returns ErrNotSupported (no UI widgets on Linux platforms).

func (*Base) StartPost

func (b *Base) StartPost(
	_ *config.Instance,
	launcherManager platforms.LauncherContextManager,
	activeMedia func() *models.ActiveMedia,
	setActiveMedia func(*models.ActiveMedia),
	_ *database.Database,
) error

StartPost initializes the platform after service startup.

func (*Base) StartPre

func (*Base) StartPre(_ *config.Instance) error

StartPre is a no-op for Linux platforms.

func (*Base) Stop

func (*Base) Stop() error

Stop is a no-op for Linux platforms.

func (*Base) StopActiveLauncher

func (b *Base) StopActiveLauncher(_ platforms.StopIntent) error

StopActiveLauncher kills tracked process and all its children, then clears active media. Uses SIGTERM first for graceful shutdown, then SIGKILL after timeout.

Directories

Path Synopsis
Package procscanner provides a shared process scanner for monitoring multiple types of processes with a single /proc scan.
Package procscanner provides a shared process scanner for monitoring multiple types of processes with a single /proc scan.
Package proctracker provides process exit tracking using pidfd_open on Linux 5.3+.
Package proctracker provides process exit tracking using pidfd_open on Linux 5.3+.

Jump to

Keyboard shortcuts

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