Skip to content

Steam Utils

Utility functions and system information.

Methods

isSteamDeck()

Check if running on Steam Deck.

javascript
const isDeck = await steam.isSteamDeck();
if (isDeck) {
  // Adjust UI for Steam Deck
}

isSteamInBigPictureMode()

Check if Steam is in Big Picture Mode.

javascript
const isBigPicture = await steam.isSteamInBigPictureMode();

getServerRealTime()

Get Steam server time (Unix timestamp).

javascript
const timestamp = await steam.getServerRealTime();
const date = new Date(timestamp * 1000);

getIPCountry()

Get user's country code from IP.

javascript
const country = await steam.getIPCountry();
// 'US', 'DE', 'JP', etc.

getBuildId()

Get the app's build ID.

javascript
const buildId = await steam.getBuildId();

Steam Deck Keyboard

showFloatingGamepadTextInput(mode, x, y, width, height)

Opens the Steam Deck on-screen keyboard overlaid on the game. The keyboard sends key events directly to the focused element — no callback needed.

modeDescription
0Single line
1Multiple lines
2Email
3Numeric
javascript
// Show keyboard positioned over an input field
const rect = inputEl.getBoundingClientRect();
await steam.showFloatingGamepadTextInput(0, rect.x, rect.y, rect.width, rect.height);

STEAM DECK

This is the recommended approach for Steam Deck input. The keyboard injects key events directly into the focused DOM element — you don't need to read the result manually.

showGamepadTextInput(inputMode, lineMode, description, maxChars, existingText)

Opens the Big Picture text input dialog (modal, blocks game). Use this when you need the full submitted string rather than live key events.

inputModeDescription
0Normal
1Password
lineModeDescription
0Single line
1Multiple lines
javascript
await steam.showGamepadTextInput(0, 0, 'Enter your name', 64, currentName);

Listen for the result via runCallbacks() and getEnteredGamepadTextInput().

getEnteredGamepadTextInput()

Returns the text submitted via showGamepadTextInput(). Call this after a GamepadTextInputDismissed callback with submitted: true.

javascript
// In your callbacks loop, after GamepadTextInputDismissed fires:
const text = await steam.getEnteredGamepadTextInput();
if (text) playerName = text;

getCurrentGameLanguage()

Get the game's language setting.

javascript
const lang = await steam.getCurrentGameLanguage();
// 'english', 'german', 'japanese', etc.

getAvailableGameLanguages()

Get list of supported languages.

javascript
const languages = await steam.getAvailableGameLanguages();
// 'english,german,french,spanish'

DLC

getDLCCount()

Get number of DLCs.

javascript
const count = await steam.getDLCCount();

isDlcInstalled(appId)

Check if DLC is installed.

javascript
if (await steam.isDlcInstalled(12345)) {
  // Enable DLC content
}

isSubscribedApp(appId)

Check if user owns an app.

javascript
const ownsGame = await steam.isSubscribedApp(480);

isAppInstalled(appId)

Check if an app is installed.

javascript
const installed = await steam.isAppInstalled(480);

getAppInstallDir(appId)

Get installation directory of an app.

javascript
const dir = await steam.getAppInstallDir(480);

Workshop

getNumSubscribedItems()

Get number of subscribed workshop items.

javascript
const count = await steam.getNumSubscribedItems();

getSubscribedItems()

Get list of subscribed workshop item IDs.

javascript
const items = await steam.getSubscribedItems();
// Array of workshop item IDs

Examples

Steam Deck Optimization

javascript
async function initGame() {
  const isDeck = await steam.isSteamDeck();
  
  if (isDeck) {
    // Lower resolution for performance
    setResolution(1280, 800);
    // Larger UI elements
    setUIScale(1.5);
    // Controller-first input
    setInputMode('controller');
  }
}

Localization

javascript
async function loadLocalization() {
  const lang = await steam.getCurrentGameLanguage();
  
  const translations = await fetch(`lang/${lang}.json`);
  return translations.json();
}

DLC Content

javascript
const DLC_IDS = {
  soundtrack: 12345,
  expansion: 12346,
  skins: 12347
};

async function checkDLC() {
  const owned = {};
  
  for (const [name, id] of Object.entries(DLC_IDS)) {
    owned[name] = await steam.isDlcInstalled(id);
  }
  
  return owned;
}

async function loadContent() {
  const dlc = await checkDLC();
  
  if (dlc.expansion) {
    loadExpansionContent();
  }
  
  if (dlc.skins) {
    loadExtraSkins();
  }
}

Region-Based Features

javascript
async function initRegionalFeatures() {
  const country = await steam.getIPCountry();
  
  // Disable features in certain regions
  const restrictedCountries = ['CN', 'KR'];
  if (restrictedCountries.includes(country)) {
    disableOnlineFeatures();
  }
}