MoonDeck

repository·main·Indexed 43 days ago

https://github.com/frogthefrog/moondeck

An automation plugin and companion app (MoonDeck Buddy) that enables seamless streaming of Steam games via Moonlight without needing to manually add them to Sunshine first, providing an experience similar to GeForce GameStream or Steam Remote Play. Version 1.12.2.

Tokens
12.3K
Snippets
47
Records
65
Agent score
45%

What's inside MoonDeck

  1. What is MoonDeck?

    main

    MoonDeck is an automation plugin designed to simplify launching Steam games via the Moonlight client for streaming. It allows you to play Steam games through Moonlight without manually adding them to Sunshine first, providing an experience similar to GeForce GameStream or Steam Remote Play.

    Requirement: MoonDeck requires a lightweight companion application called MoonDeck Buddy to be installed on the host PC.

  2. Build and deploy the MoonDeck plugin

    main

    To build and deploy the plugin package, follow these steps:

    1. Copy .env.example to .env and update any relevant settings.
    2. Execute the build and deployment commands using pnpm:
    pnpm run setup
    pnpm run build:plugin
    pnpm run deploy

    Alternatively, you can use VSCode tasks by pressing Ctrl+Shift+P (or Cmd+Shift+P on macOS), selecting Tasks: Run Task, and choosing the desired task.

    pnpm run setup && pnpm run build:plugin && pnpm run deploy
  3. Initialize the MoonDeck plugin

    main

    MoonDeck is a Decky plugin that uses definePlugin to register its lifecycle and UI components. The plugin initializes several managers (shortcuts, settings, connectivity, and launcher) and a RouteManager once Steam services are ready. It handles user login state changes by triggering an initialization callback that waits for non-Steam app details to be available before proceeding.

    import { definePlugin } from "@decky/api";
    import { QuickSettingsView } from "./components/quicksettingsview/quicksettingsview";
    import { TitleView } from "./components/titleview";
    
    export default definePlugin(() => {
      return {
        name: "MoonDeck",
        icon: <MoonDeckMain />,
        content: <QuickSettingsView />,
        onDismount() {
          // Cleanup logic
        },
        alwaysRender: true,
        titleView: <TitleView />
      };
    });
  4. Configure ESLint for MoonDeck

    main

    MoonDeck uses a flat configuration format via eslint.config.mjs. The configuration integrates recommended rules from @eslint/js, type-checked rules from typescript-eslint, and stylistic rules from @stylistic/eslint-plugin.

    Key configuration aspects include:

    • Type Checking: Uses tsconfig.json for parser options to enable type-aware linting.
    • Stylistic Preferences: Configured for 1tbs brace style, double quotes, no trailing commas, and mandatory semicolons.
    • Unused Variables: The @typescript-eslint/no-unused-vars rule is strictly enforced but allows ignoring variables that start with an underscore (_).
    • Import Sorting: Enforces strict import sorting via sort-imports with specific member syntax orders.
    import { defineConfig } from "eslint/config";
    import eslint from "@eslint/js";
    import stylistic from "@stylistic/eslint-plugin";
    import tseslint from "typescript-eslint";
    
    export default defineConfig(
      eslint.configs.recommended,
      tseslint.configs.recommendedTypeChecked,
      stylistic.configs.customize({
        arrowParens: true,
        braceStyle: "1tbs",
        commaDangle: "never",
        quotes: "double",
        semi: true
      }),
      // ... additional rules and file overrides
    );
  5. Configure MoonDeck CLI global options

    main

    Global flags can be used with any command to modify logging or configuration behavior.

    • --verbose: Enables verbose logging.
    • --log-file <path>: Specifies a path to an optional log file.
    • --config-file <path>: Specifies the path to the configuration file (defaults to config.json).
    moondeck --verbose --config-file my_config.json app status
  6. Locate MoonDeck logs and settings

    main

    MoonDeck stores its configuration and logs in the following locations:

    Data TypePath
    Settings/home/$USER/.config/moondeck/settings.json
    Backend logs/tmp/moondeck.log
    Runner logs/tmp/moondeck-runner.log
    Moonlight logs/tmp/moondeck-runner-moonlight.log
    Frontend logsWritten to the web console
  7. Manage Host discovery and server information

    main

    Use these methods to interact with GameStream hosts on the network.

    • scan_for_hosts(timeout): Scans the network for available hosts. Returns a list of hosts.
    • find_host(host_id, timeout): Locates a specific host by its ID.
    • get_server_info(address, port, timeout): Retrieves detailed information about a specific server at the given address and port.
    await plugin.scan_for_hosts(timeout=5.0)
    await plugin.find_host(host_id="some_id", timeout=5.0)
    await plugin.get_server_info(address="192.168.1.10", port=47984, timeout=5.0)
  8. Use the StatusIndicatorsView component

    main

    The StatusIndicatorsView component is the primary entry point for displaying status indicators within the MoonDeck UI. It is exported from the src/components/statusindicatorsview module. To use it, import the exported members from the package entry point.

    import { StatusIndicatorsView } from './components/statusindicatorsview';
    
    // Usage depends on the specific props and implementation details 
    // defined in the underlying module.