game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
GameSessionService Class Reference

Manages system-level game session state (screensaver, power profile). More...

#include <game_session_service.h>

Public Member Functions

 GameSessionService (const GameSessionService &)=delete
int activeGameCount () const
 Get current number of running games being tracked.
bool isActive () const
 Check if any inhibitions are currently active.
void onGameStarted ()
 Called when a game starts running.
void onGameStopped ()
 Called when a game stops running.
GameSessionService & operator= (const GameSessionService &)=delete

Static Public Member Functions

static GameSessionService & instance ()
 Get singleton instance.

Detailed Description

Manages system-level game session state (screensaver, power profile).

Singleton service that inhibits screensaver and switches power profile when games are running. Uses reference counting to handle multiple simultaneous game sessions.

Definition at line 39 of file game_session_service.h.

Constructor & Destructor Documentation

◆ GameSessionService()

GameSessionService::GameSessionService ( const GameSessionService & )
delete

Member Function Documentation

◆ activeGameCount()

int GameSessionService::activeGameCount ( ) const

Get current number of running games being tracked.

Definition at line 102 of file game_session_service.cpp.

◆ instance()

GameSessionService & GameSessionService::instance ( )
static

◆ isActive()

bool GameSessionService::isActive ( ) const

Check if any inhibitions are currently active.

Definition at line 96 of file game_session_service.cpp.

◆ onGameStarted()

void GameSessionService::onGameStarted ( )

Called when a game starts running.

On first game start:

  • Inhibits screensaver via systemd-inhibit
  • Switches to performance power profile (if powerprofilesctl available)

Uses reference counting for multiple simultaneous games.

Definition at line 55 of file game_session_service.cpp.

References Logger::info().

Referenced by GameProcessManager::launchGame(), and core::LaunchController::update().

◆ onGameStopped()

void GameSessionService::onGameStopped ( )

Called when a game stops running.

When last game stops:

  • Releases screensaver inhibition
  • Restores previous power profile

Definition at line 73 of file game_session_service.cpp.

References Logger::info(), and Logger::warn().

Referenced by GameProcessManager::stopGame(), core::LaunchController::update(), and GameProcessManager::update().

◆ operator=()

GameSessionService & GameSessionService::operator= ( const GameSessionService & )
delete

References GameSessionService().


The documentation for this class was generated from the following files: