Documentation
¶
Overview ¶
Package steamtracker provides Steam game lifecycle tracking on Linux. It detects game starts by monitoring Steam's reaper processes and game exits using pidfd/polling.
Index ¶
Constants ¶
const DefaultPollInterval = 2 * time.Second
DefaultPollInterval is the default interval for game state scanning.
Variables ¶
This section is empty.
Functions ¶
func FindGamePID ¶
FindGamePID finds a running process that matches the game executable path.
func FindGamePIDWithProcPath ¶
FindGamePIDWithProcPath finds a running process matching the game path using a custom proc path. It first tries to find an exact match for the game executable, then falls back to searching for any process in the game's install directory.
Types ¶
type GameStartCallback ¶
GameStartCallback is called when a Steam game starts. appID is the Steam App ID, pid is the process ID (reaper on Linux, game on Windows), gamePath is the game executable path.
type GameStopCallback ¶
type GameStopCallback func(appID int)
GameStopCallback is called when a Steam game exits. appID is the Steam App ID that was running.
type PlatformIntegration ¶
type PlatformIntegration struct {
// contains filtered or unexported fields
}
PlatformIntegration provides common game tracking integration for Steam-based platforms. It handles game start/stop callbacks and ActiveMedia management.
func NewPlatformIntegration ¶
func NewPlatformIntegration( scanner *procscanner.Scanner, base *linuxbase.Base, activeMedia func() *models.ActiveMedia, setActiveMedia func(*models.ActiveMedia), ) *PlatformIntegration
NewPlatformIntegration creates a new platform integration for game tracking.
func (*PlatformIntegration) Start ¶
func (pi *PlatformIntegration) Start()
Start begins monitoring for Steam games.
func (*PlatformIntegration) Stop ¶
func (pi *PlatformIntegration) Stop()
Stop stops the game tracker.
type ReaperProcess ¶
ReaperProcess represents a running Steam game detected via its reaper process.
func ScanReaperProcesses ¶
func ScanReaperProcesses() ([]ReaperProcess, error)
ScanReaperProcesses finds all Steam reaper processes and their AppIDs. Steam wraps game launches: ~/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=XXXXX -- [cmd]
func ScanReaperProcessesWithProcPath ¶
func ScanReaperProcessesWithProcPath(procPath string) ([]ReaperProcess, error)
ScanReaperProcessesWithProcPath scans for reaper processes using a custom proc path. This allows testing with mock filesystems.
type TrackedGame ¶
TrackedGame represents a currently tracked Steam game.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker monitors Steam game lifecycle events on Linux.
func New ¶
func New(scanner *procscanner.Scanner, onStart GameStartCallback, onStop GameStopCallback) *Tracker
New creates a new game tracker. scanner must be a running process scanner. onStart is called when a game starts, onStop is called when a game exits.
func (*Tracker) TrackedGames ¶
func (t *Tracker) TrackedGames() []TrackedGame
TrackedGames returns a copy of currently tracked games.