steam

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Overview

Package steam provides local Steam integration for shortcuts and artwork management.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSteamNotFound     = errors.New("steam installation not found")
	ErrUserNotFound      = errors.New("steam user not found")
	ErrImageNotFound     = errors.New("image not found")
	ErrShortcutsNotFound = errors.New("shortcuts.vdf not found")
)

Common errors for Steam operations.

Functions

func ConvertToShortcutInfo

func ConvertToShortcutInfo(cfg protocol.ShortcutConfig) protocol.ShortcutInfo

ConvertToShortcutInfo converts a protocol.ShortcutConfig to protocol.ShortcutInfo.

func GenerateAppID

func GenerateAppID(exe, name string) uint32

GenerateAppID generates a Steam shortcut app ID from executable path and name. This matches Steam's algorithm for non-Steam game shortcuts.

func LoadShortcutsVDF added in v0.3.0

func LoadShortcutsVDF(path string) ([]protocol.ShortcutInfo, error)

LoadShortcutsVDF parses a binary VDF shortcuts file and returns shortcut info. The binary VDF format uses type markers (\x00=object, \x01=string, \x02=int32, \x08=end).

func Uint32ToUserID

func Uint32ToUserID(userID uint32) string

Uint32ToUserID converts a uint32 user ID to string.

func UserIDToUint32

func UserIDToUint32(userID string) (uint32, error)

UserIDToUint32 converts a string user ID to uint32.

Types

type ArtworkType

type ArtworkType int

ArtworkType represents the type of Steam artwork.

const (
	ArtworkGrid     ArtworkType = iota // 460x215 horizontal banner
	ArtworkHero                        // 1920x620 header
	ArtworkIcon                        // square icon
	ArtworkPortrait                    // 600x900 vertical grid
)

type Paths

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

Paths provides access to Steam directory paths.

func NewPaths

func NewPaths() (*Paths, error)

NewPaths creates a new Paths instance with auto-detected Steam directory.

func NewPathsWithBase

func NewPathsWithBase(baseDir string) *Paths

NewPathsWithBase creates a new Paths instance with a custom base directory.

func (*Paths) ArtworkPath

func (p *Paths) ArtworkPath(userID string, appID uint32, artType ArtworkType, ext string) string

ArtworkPath returns the path for a specific artwork type.

func (*Paths) BaseDir

func (p *Paths) BaseDir() string

BaseDir returns the Steam base directory.

func (*Paths) ConfigDir

func (p *Paths) ConfigDir(userID string) string

ConfigDir returns the config directory for a user.

func (*Paths) EnsureGridDir

func (p *Paths) EnsureGridDir(userID string) error

EnsureGridDir creates the grid directory if it doesn't exist.

func (*Paths) GridDir

func (p *Paths) GridDir(userID string) string

GridDir returns the grid artwork directory for a user.

func (*Paths) HasShortcuts

func (p *Paths) HasShortcuts(userID string) bool

HasShortcuts returns true if the user has a shortcuts.vdf file.

func (*Paths) ShortcutsPath

func (p *Paths) ShortcutsPath(userID string) string

ShortcutsPath returns the path to shortcuts.vdf for a user.

func (*Paths) UserDataDir

func (p *Paths) UserDataDir() string

UserDataDir returns the userdata directory.

func (*Paths) UserDir

func (p *Paths) UserDir(userID string) string

UserDir returns the directory for a specific user.

type ShortcutManager

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

ShortcutManager handles Steam shortcut operations.

func NewShortcutManager

func NewShortcutManager() (*ShortcutManager, error)

NewShortcutManager creates a new ShortcutManager.

func NewShortcutManagerWithPaths

func NewShortcutManagerWithPaths(paths *Paths) *ShortcutManager

NewShortcutManagerWithPaths creates a ShortcutManager with custom paths.

func (*ShortcutManager) ArtworkPaths

func (m *ShortcutManager) ArtworkPaths(userID string, appID uint32) map[ArtworkType]string

ArtworkPaths returns all artwork paths for a shortcut.

func (*ShortcutManager) DeleteArtwork

func (m *ShortcutManager) DeleteArtwork(userID string, appID uint32) error

DeleteArtwork removes all artwork for an appID.

func (*ShortcutManager) EnsureGridDir

func (m *ShortcutManager) EnsureGridDir(userID string) error

EnsureGridDir creates the grid directory if it doesn't exist.

func (*ShortcutManager) FindExistingArtwork

func (m *ShortcutManager) FindExistingArtwork(userID string, appID uint32) (map[ArtworkType]string, error)

FindExistingArtwork finds existing artwork files for an appID.

func (*ShortcutManager) GetGridDir

func (m *ShortcutManager) GetGridDir(userID string) string

GetGridDir returns the grid artwork directory for a user.

func (*ShortcutManager) GetShortcutsPath

func (m *ShortcutManager) GetShortcutsPath(userID string) string

GetShortcutsPath returns the shortcuts.vdf path for a user.

func (*ShortcutManager) SaveArtwork

func (m *ShortcutManager) SaveArtwork(userID string, appID uint32, artType ArtworkType, data []byte, ext string) error

SaveArtwork saves artwork data to the appropriate path.

type User

type User struct {
	ID           string `json:"id"`
	HasShortcuts bool   `json:"hasShortcuts"`
}

User represents a Steam user with shortcuts.

func GetFirstUserWithShortcuts

func GetFirstUserWithShortcuts() (*User, error)

GetFirstUserWithShortcuts returns the first user that has shortcuts.

func GetUsers

func GetUsers() ([]User, error)

GetUsers returns a list of Steam users from the userdata directory.

func GetUsersWithPaths

func GetUsersWithPaths(paths *Paths) ([]User, error)

GetUsersWithPaths returns users using the provided Paths instance.

Jump to

Keyboard shortcuts

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