Documentation
¶
Index ¶
- Constants
- Variables
- func BuildSteamDetailsURL(id string) string
- func BuildSteamURL(id string) string
- func DefaultSteamAppsDirs() []string
- func ExtractAndValidateID(path string) (string, error)
- func ExtractAppIDFromPath(path string) (int, bool)
- func FindAppNameByAppID(appID int) (string, bool)
- func FindInstallDirByAppID(appID int) (string, bool)
- func FindSteamAppsDir(steamDir string) string
- func FormatGameName(appID int, name string) string
- func GetGameExecutable(steamDir string, appID int) (string, bool)
- func LookupAppName(steamAppsDir string, appID int) (string, bool)
- func LookupAppNameInLibraries(steamAppsDir string, appID int) (string, bool)
- func NewSteamLauncher(opts Options) platforms.Launcher
- func NormalizePath(path string) string
- func ScanSteamApps(steamDir string) ([]platforms.ScanResult, error)
- func ScanSteamShortcuts(steamDir string) ([]platforms.ScanResult, error)
- type AppInfo
- type Client
- func (c *Client) FindSteamDir(cfg *config.Instance) string
- func (c *Client) IsSteamInstalled(cfg *config.Instance) bool
- func (c *Client) Launch(_ *config.Instance, path string, opts *platforms.LaunchOptions) (*os.Process, error)
- func (*Client) ScanApps(steamDir string) ([]platforms.ScanResult, error)
- func (*Client) ScanShortcuts(steamDir string) ([]platforms.ScanResult, error)
- type LaunchConfig
- type Options
- type SteamClient
Constants ¶
const FlatpakSteamID = "com.valvesoftware.Steam"
FlatpakSteamID is the Flatpak app ID for Steam.
Variables ¶
Functions ¶
func BuildSteamDetailsURL ¶
BuildSteamDetailsURL builds a Steam details page URL from a game ID. This opens the game's details page in the Steam client library.
func BuildSteamURL ¶
BuildSteamURL builds a Steam launch URL from a game ID.
func DefaultSteamAppsDirs ¶
func DefaultSteamAppsDirs() []string
DefaultSteamAppsDirs returns default locations for Steam's steamapps directory. These are platform-specific paths where Steam is commonly installed.
func ExtractAndValidateID ¶
ExtractAndValidateID extracts and validates the Steam game ID from a virtual path. Returns the numeric ID or an error if the path is invalid or ID is non-numeric.
func ExtractAppIDFromPath ¶
ExtractAppIDFromPath extracts an AppID from a Steam virtual path. Path format: "steam://[id]/[name]" or "steam://rungameid/[id]"
func FindAppNameByAppID ¶
FindAppNameByAppID searches common Steam locations for an app's name. This is a convenience function that tries multiple locations.
func FindInstallDirByAppID ¶
FindInstallDirByAppID searches common Steam locations for an app's install directory. Returns the full path to the game's install directory (e.g., /path/to/steamapps/common/GameName).
func FindSteamAppsDir ¶
FindSteamAppsDir finds the steamapps directory from a Steam root directory. It checks for both lowercase and mixed-case "steamapps" directories.
func FormatGameName ¶
FormatGameName returns a formatted game name for display. If the name is found, returns it; otherwise returns "Steam Game {AppID}".
func GetGameExecutable ¶
GetGameExecutable returns the best executable path for the current OS. It reads appinfo.vdf to find the launch configuration. Returns the full path to the executable, or empty string if not found.
func LookupAppName ¶
LookupAppName finds the name of a Steam app by its AppID. Returns the app name and true if found, or empty string and false if not. steamAppsDir should point to the steamapps directory (e.g., ~/.steam/steam/steamapps).
func LookupAppNameInLibraries ¶
LookupAppNameInLibraries searches all Steam library folders for an app. steamAppsDir should point to the main steamapps directory.
func NewSteamLauncher ¶
NewSteamLauncher creates a configurable Steam launcher.
func NormalizePath ¶
NormalizePath normalizes Steam URL formats to the standard virtual path format. Converts "steam://rungameid/123" to "steam://123".
func ScanSteamApps ¶
func ScanSteamApps(steamDir string) ([]platforms.ScanResult, error)
ScanSteamApps scans official Steam games from the libraryfolders.vdf file. steamDir should point to the steamapps directory (e.g., ~/.steam/steam/steamapps).
func ScanSteamShortcuts ¶
func ScanSteamShortcuts(steamDir string) ([]platforms.ScanResult, error)
ScanSteamShortcuts scans Steam shortcuts (non-Steam games) from the shortcuts.vdf file. steamDir should point to the Steam root directory.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements SteamClient for Steam game launching and scanning.
func NewClientWithExecutor ¶
NewClientWithExecutor creates a new Steam client with a custom command executor. This is useful for testing.
func (*Client) FindSteamDir ¶
FindSteamDir locates the Steam installation directory on Linux.
func (*Client) IsSteamInstalled ¶
IsSteamInstalled checks if Steam is installed by verifying the Steam directory exists. Uses FindSteamDir to locate the directory, respecting config overrides.
func (*Client) Launch ¶
func (c *Client) Launch( _ *config.Instance, path string, opts *platforms.LaunchOptions, ) (*os.Process, error)
Launch launches a Steam game on Linux using xdg-open or the direct steam command.
func (*Client) ScanApps ¶
func (*Client) ScanApps(steamDir string) ([]platforms.ScanResult, error)
ScanApps scans Steam library for installed official apps. steamDir should point to the steamapps directory (e.g., ~/.steam/steam/steamapps).
func (*Client) ScanShortcuts ¶
func (*Client) ScanShortcuts(steamDir string) ([]platforms.ScanResult, error)
ScanShortcuts scans Steam for non-Steam games (user-added shortcuts). steamDir should point to the Steam root directory.
type LaunchConfig ¶
type LaunchConfig struct {
Executable string // Relative executable path (e.g., "game.exe")
Arguments string // Launch arguments
Type string // Launch type ("default", "none", "option1", etc.)
OSList string // Target OS ("windows", "linux", "macos")
WorkingDir string // Relative working directory
}
LaunchConfig contains launch configuration from appinfo.vdf.
func ReadLaunchConfigs ¶
func ReadLaunchConfigs(steamDir string, appID int) ([]LaunchConfig, error)
ReadLaunchConfigs reads launch configurations for an app from appinfo.vdf.
type Options ¶
type Options struct {
// FallbackPath is used if Steam directory detection fails.
// Linux examples: "/home/deck/.steam/steam", "/usr/games/steam"
// Windows example: "C:\\Program Files (x86)\\Steam"
FallbackPath string
// ExtraPaths are additional paths to check for Steam installation.
// Only used on Linux; ignored on Windows.
ExtraPaths []string
// UseXdgOpen uses xdg-open for launching (desktop-friendly).
// When false, uses direct `steam` command (console/Game Mode friendly).
// Only used on Linux; ignored on Windows.
UseXdgOpen bool
// CheckFlatpak enables checking for Flatpak Steam installation.
// Only used on Linux; ignored on Windows.
CheckFlatpak bool
}
Options configures Steam client behavior across all platforms.
func DefaultBazziteOptions ¶
func DefaultBazziteOptions() Options
DefaultBazziteOptions returns settings for Bazzite (Fedora Atomic gaming distro).
func DefaultChimeraOSOptions ¶
func DefaultChimeraOSOptions() Options
DefaultChimeraOSOptions returns optimized settings for ChimeraOS.
func DefaultDarwinOptions ¶
func DefaultDarwinOptions() Options
DefaultDarwinOptions returns sensible defaults for macOS.
func DefaultLinuxOptions ¶
func DefaultLinuxOptions() Options
DefaultLinuxOptions returns sensible defaults for desktop Linux.
func DefaultSteamOSOptions ¶
func DefaultSteamOSOptions() Options
DefaultSteamOSOptions returns optimized settings for SteamOS/Steam Deck.
func DefaultWindowsOptions ¶
func DefaultWindowsOptions() Options
DefaultWindowsOptions returns sensible defaults for Windows.
type SteamClient ¶
type SteamClient interface {
// FindSteamDir locates the Steam installation directory.
// Returns the path to the Steam root directory or the fallback path.
FindSteamDir(cfg *config.Instance) string
// IsSteamInstalled checks if Steam is installed by verifying the Steam directory exists.
// Uses FindSteamDir to locate the directory, respecting config overrides.
IsSteamInstalled(cfg *config.Instance) bool
// Launch launches a Steam game by its virtual path.
// Path format: "steam://[id]/[name]" or "steam://rungameid/[id]"
// Returns nil for fire-and-forget launches (Steam handles the process).
// The opts parameter is optional and may be nil.
Launch(cfg *config.Instance, path string, opts *platforms.LaunchOptions) (*os.Process, error)
// ScanApps scans Steam library for installed official apps.
// steamAppsDir should point to the steamapps directory (e.g., ~/.steam/steam/steamapps).
ScanApps(steamAppsDir string) ([]platforms.ScanResult, error)
// ScanShortcuts scans Steam for non-Steam games (user-added shortcuts).
// steamDir should point to the Steam root directory.
ScanShortcuts(steamDir string) ([]platforms.ScanResult, error)
}
SteamClient defines the interface for Steam operations. This interface enables proper mocking and TDD for Steam integration.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package steamtracker provides Steam game lifecycle tracking on Linux.
|
Package steamtracker provides Steam game lifecycle tracking on Linux. |