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
- func ArtworkTypeToCEFAsset(artworkType string) (int, bool)
- func EnsureCEFDebugFile() (created bool, err error)
- func EnsureCEFReady() error
- type CEFClient
- func (c *CEFClient) AddShortcut(ctx context.Context, name, exe, startDir, launchOptions string) (uint32, error)
- func (c *CEFClient) ClearCustomArtwork(ctx context.Context, appID uint32, assetType int) error
- func (c *CEFClient) RemoveShortcut(ctx context.Context, appID uint32) error
- func (c *CEFClient) SetCustomArtwork(ctx context.Context, appID uint32, base64Data string, assetType int) error
- func (c *CEFClient) SetShortcutLaunchOptions(ctx context.Context, appID uint32, options string) error
- func (c *CEFClient) SetShortcutName(ctx context.Context, appID uint32, name string) error
- func (c *CEFClient) SpecifyCompatTool(ctx context.Context, appID uint32, toolName string) error
- type Controller
- func (c *Controller) EnsureRunning() error
- func (c *Controller) IsCEFAvailable() bool
- func (c *Controller) IsGamingMode() bool
- func (c *Controller) IsRunning() bool
- func (c *Controller) Restart() *RestartResult
- func (c *Controller) Shutdown() error
- func (c *Controller) Start() error
- func (c *Controller) WaitForCEF() error
- type RestartResult
Constants ¶
const ( CEFAssetGridPortrait = 0 // 600x900 CEFAssetHero = 1 // 1920x620 CEFAssetLogo = 2 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
ArtworkTypeToCEFAsset maps artwork type strings to CEF asset type constants.
func EnsureCEFDebugFile ¶ added in v0.3.0
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
ClearCustomArtwork removes custom artwork from a Steam app via CEF API.
func (*CEFClient) RemoveShortcut ¶ added in v0.3.0
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
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.
type Controller ¶
type Controller struct{}
Controller manages Steam process operations.
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 ¶
RestartResult contains the result of a Steam restart operation.