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: 13 Imported by: 0

Documentation

Overview

Package steam provides Steam control and CEF client operations for the Agent. The CEF client connects to Steam's embedded Chromium (CEF) debugger via Chrome DevTools Protocol to execute JavaScript commands like SetCustomArtworkForApp.

Package steam provides Steam control operations for the Agent.

Index

Constants

View Source
const (
	CEFAssetGridPortrait  = 0 // 600x900
	CEFAssetHero          = 1 // 1920x620
	CEFAssetGridLandscape = 3 // 920x430
	CEFAssetIcon          = 4
)

CEF asset type constants matching SteamClient.Apps.SetCustomArtworkForApp.

Variables

This section is empty.

Functions

func ArtworkTypeToCEFAsset added in v0.3.0

func ArtworkTypeToCEFAsset(artworkType string) (int, bool)

ArtworkTypeToCEFAsset maps artwork type strings to CEF asset type constants.

func EnsureCEFDebugFile added in v0.3.0

func EnsureCEFDebugFile() (created bool, err error)

EnsureCEFDebugFile creates the .cef-enable-remote-debugging file in Steam's base directory if it doesn't exist. This file tells Steam to enable the CEF remote debugger on port 8080. Returns true if the file was just created (meaning Steam needs a restart for CEF to become available).

func EnsureCEFReady added in v0.3.0

func EnsureCEFReady() error

EnsureCEFReady guarantees that the CEF debugger is available. CEF only works when Steam is running with the debug file present at startup. Flow: check CEF → ensure debug file → restart/start Steam as needed.

Types

type CEFClient added in v0.3.0

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

CEFClient communicates with Steam's CEF debugger via Chrome DevTools Protocol.

func NewCEFClient added in v0.3.0

func NewCEFClient() *CEFClient

NewCEFClient creates a new CEF client targeting the local Steam debugger.

func (*CEFClient) AddShortcut added in v0.3.0

func (c *CEFClient) AddShortcut(ctx context.Context, name, exe, startDir, launchOptions string) (uint32, error)

AddShortcut creates a Steam shortcut via CEF API and returns the new AppID. Uses SteamClient.Apps.AddShortcut(name, exe, startDir, launchOptions) which returns a Promise<number>.

func (*CEFClient) ClearCustomArtwork added in v0.3.0

func (c *CEFClient) ClearCustomArtwork(ctx context.Context, appID uint32, assetType int) error

ClearCustomArtwork removes custom artwork from a Steam app via CEF API.

func (*CEFClient) RemoveShortcut added in v0.3.0

func (c *CEFClient) RemoveShortcut(ctx context.Context, appID uint32) error

RemoveShortcut removes a Steam shortcut via CEF API.

func (*CEFClient) SetCustomArtwork added in v0.3.0

func (c *CEFClient) SetCustomArtwork(ctx context.Context, appID uint32, base64Data string, assetType int) error

SetCustomArtwork applies custom artwork to a Steam app via CEF API.

func (*CEFClient) SetShortcutLaunchOptions added in v0.3.0

func (c *CEFClient) SetShortcutLaunchOptions(ctx context.Context, appID uint32, options string) error

SetShortcutLaunchOptions sets launch options for a shortcut via CEF API.

func (*CEFClient) SetShortcutName added in v0.3.0

func (c *CEFClient) SetShortcutName(ctx context.Context, appID uint32, name string) error

SetShortcutName renames a shortcut via CEF API. AddShortcut ignores the name parameter and uses the executable filename, so this must be called after creation to set the correct name.

func (*CEFClient) SpecifyCompatTool added in v0.3.0

func (c *CEFClient) SpecifyCompatTool(ctx context.Context, appID uint32, toolName string) error

SpecifyCompatTool sets the compatibility tool (e.g. Proton) for a shortcut via CEF API. Uses SteamClient.Apps.SpecifyCompatTool(appID, toolName).

type Controller

type Controller struct{}

Controller manages Steam process operations.

func NewController

func NewController() *Controller

NewController creates a new Steam controller.

func (*Controller) EnsureRunning

func (c *Controller) EnsureRunning() error

EnsureRunning makes sure Steam is running and CEF is available. If Steam is not running, it starts it and waits for CEF.

func (*Controller) IsCEFAvailable

func (c *Controller) IsCEFAvailable() bool

IsCEFAvailable checks if Steam's CEF debugger is responding.

func (*Controller) IsGamingMode

func (c *Controller) IsGamingMode() bool

IsGamingMode returns true if running in SteamOS/Bazzite Gaming Mode

func (*Controller) IsRunning

func (c *Controller) IsRunning() bool

IsRunning checks if Steam is currently running.

func (*Controller) Restart

func (c *Controller) Restart() *RestartResult

Restart performs a full restart of Steam. Shuts down Steam, waits for it to close, starts it again, and waits for CEF.

func (*Controller) Shutdown

func (c *Controller) Shutdown() error

Shutdown gracefully closes Steam and waits for it to exit.

func (*Controller) Start

func (c *Controller) Start() error

Start launches Steam if it's not already running.

func (*Controller) WaitForCEF

func (c *Controller) WaitForCEF() error

WaitForCEF waits until Steam's CEF debugger is available or timeout.

type RestartResult

type RestartResult struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

RestartResult contains the result of a Steam restart operation.

Jump to

Keyboard shortcuts

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