Skip to content

SteamMachine DIY Control Center

dlucca1986 edited this page Mar 9, 2026 · 9 revisions

Version License: MIT Code Style: PEP8 Language: Python

This manual provides a technical breakdown of the Control Center (steamos-diy-control), a PyQt6 dashboard that provides a high-level interface to manage system configurations, hardware diagnostics, and game-specific profiles without ever needing to open a terminal.


📂 UI Navigation & Tab Logic

1. Diagnostics (Tab Index 0)

The default tab for real-time monitoring and troubleshooting.

  • Component Filter: Instead of targeting a single service, it uses dynamic pattern matching via journalctl -g to aggregate logs from CORE, STEAM, and SYSTEM tags.
  • Log Sanitization: Utilizes the LogFilter class to suppress repetitive messages and clean up timestamps/PIDs, making the logs more readable.
  • Export: Allows copying logs to the clipboard or exporting a comprehensive support file for troubleshooting.

2. Maintenance (Tab Index 1)

Handles critical system-level operations through a simplified interface that automates complex commands using pkexec and background processes.

🛠️ System Management

  • 🎮 Switch to Steam (Game Mode): Triggers the transition to the Steam Deck UI session via session_select.py.
  • 📝 Edit System Config (SSoT): Opens /etc/default/steamos_diy.conf using an external graphical editor (Kate or Kwrite) with privilege delegation.
  • 🧹 Clean System Logs (Vacuum): Executes journalctl --vacuum-time=1s with root privileges to reclaim disk space instantly.
  • 🔄 Reboot System: Sends an immediate reboot signal, protected by a confirmation prompt.

📦 Backup & Recovery

  • Create Full System Backup: Generates a .tar.gz archive of all configurations. This process runs in a separate thread to keep the UI responsive.
  • Restore from Archive: Restoration of the entire SteamOS-DIY configuration hierarchy from a selected backup file.

💡 Detailed Documentation: For a deep dive into the surgical backup logic, file mapping, and command-line usage, please refer to the Backup & Recovery System page.

📂 Utilities & Shortcuts

  • 🖥️ Open Konsole Terminal: Launches Konsole directly in the project directory.
  • 📂 Browse Config Folder: Opens the file manager at ~/.config/steamos_diy/.

3. Global Options (Tab Index 2)

An advanced IDE for managing the global system configuration (config.yaml) with real-time safety checks.

🧠 The Intelligent YAML Editor

  • Syntax Highlighting: Custom highlighter for keys, values, and comments.
  • 🪄 Smart Beautify: The beautify_yaml() function performs a "Round-Trip" sanitization, converting tabs to spaces and fixing indentation while preserving comments.

🛡️ Dual-Layer Validation & Safety

  • Atomic Writing: Uses _atomic_save() with os.rename to prevent file corruption during power loss.
  • Smart Error Highlighting: Provides dual-layer feedback on syntax errors:
    • 🔴 Red Highlight: The exact line where the parser failed.
    • 🟠 Orange Highlight: The preceding line, helping to identify root causes like unclosed quotes.

4. Game Overrides (Tab Index 3)

Management of per-game profiles (AppID) via dynamic log analysis.

🔍 Universal Game Discovery

  • Log Mining Engine: Parses system journals from the last 24 hours.
  • Performance Safety: Limiting analysis to the last 2000 log entries (tail -n 2000) to ensure instant UI responsiveness during Regex parsing.
  • Intelligent Mapping: Maps chdir events to Steam AppIDs to automatically identify recently launched games.

🛠️ Automated Profiling

  • Instant Scaffolding: Automatically generates a YAML template with an injected # SDY_ID header if no profile exists for the selected game.
  • State Caching: Keeps unsaved edits in memory (view_states) while switching between profiles or templates.

🛠️ Method Mapping Table

Tab Action Method Logic
0 Load Logs load_logs() journalctl -g (Pattern-based log mining)
1 Clean Logs cleanup_logs_privileged() pkexec journalctl --vacuum-time=1s
1 Backup/Restore run_backup() / run_restore() Background threading.Thread + pkexec
2 Save Config _atomic_save() os.rename (Atomic write) + YAML Validation
2 Beautify beautify_yaml() ruamel.yaml Round-Trip fix
3 Scan Games refresh_detected_games() Regex parsing (Limit: last 2000 lines)

🎨 YAML Syntax Palette

  • Comments: Grey (#7f8c8d)
  • Keys: Blue (#3498db)
  • Strings: Yellow (#f1c40f)
  • Numbers: Orange (#e67e22)
  • Errors: Red Background (#e74c3c)

🔍 Log Analysis Semantic Palette

  • Red: ERROR: and CRITICAL: tags.
  • Orange: WARNING:, DEBUG:, and SYSTEM: tags.
  • Green: STEAM: metadata.
  • Blue: CORE: project metadata.

🛠️ Internal Logic: The Round-Trip Engine

  • SSoT Sync: On startup, variables from /etc/default/steamos_diy.conf are injected into the environment to ensure the UI and system are synchronized.
# The dashboard uses Round-Trip parsing to respect user comments
yaml_parser = YAML()
yaml_parser.preserve_quotes = True
yaml_parser.indent(mapping=2, sequence=4, offset=2)

# Logic: Load -> Modify specific keys -> Dump back to file
data = yaml_parser.load(current_text)
# ... modifications ...
yaml_parser.dump(data, file_stream)

📊 Troubleshooting Workflow

Goal Recommended Action
Debug a Crash Open the Diagnostics tab and search for ERROR: or CORE: tags to identify where the session failed.
Verify Configuration Use the Global Options tab; the editor will highlight syntax errors in red and orange if the YAML is invalid.
Real-time Monitoring Run journalctl -u steamos_diy.service -f in a terminal to watch the Live Session Manager output.
System Recovery If binary shims or links are broken, use the Restore from Archive tool in the Maintenance tab.
Game Specific Profile Use the Game Overrides tab to create or edit .yaml profiles for specific Steam AppIDs.

⬅️ Back to Home.

Clone this wiki locally