Skip to content

LaunchManager

Inherits: Resource

Launch and manage the lifecycle of subprocesses

Description

The LaunchManager class is responsible starting and managing the lifecycle of games and is one of the most complex systems in OpenGamepadUI. Using gamescope, it manages what games start, if their process is still running, and fascilitates window switching between games. It also provides a mechanism to kill running games and discover child processes. It uses a timer to periodically check on launched games to see if they have exited, or are opening new windows that might need attention. Example:

    var launch_manager := load("res://core/global/launch_manager.tres") as LaunchManager
    ...
    # Create a LibraryLaunchItem to run something
    var item := LibraryLaunchItem.new()
    item.command = "vkcube"

    # Launch the app with LaunchManager
    var running_app := launch_manager.launch(item)

    # Get a list of running apps
    var running := launch_manager.get_running()
    print(running)

    # Stop an app with LaunchManager
    launch_manager.stop(running_app)

Properties

Type Name Default
GamescopeInstance gamescope
InputPlumberInstance input_plumber
StateMachine state_machine
State in_game_state
State in_game_menu_state
int PID
bool should_manage_overlay true
CustomLogger logger

Methods

Returns Signature
void setup(input_manager: InputManager)
RunningApp launch(app: LibraryLaunchItem)
RunningApp launch_in_background(app: LibraryLaunchItem)
void stop(app: RunningApp)
Array get_recent_apps()
void update_recent_apps(app: LibraryLaunchItem)
RunningApp[] get_running()
RunningApp[] get_running_background()
RunningApp get_running_from_window_id(window_id: int)
RunningApp get_current_app()
LibraryItem get_current_app_library_item()
void set_app_gamepad_profile(app: RunningApp)
void set_gamepad_profile(profile_path: String, target_gamepad: String = "")
void set_current_app(app: RunningApp, _switch_baselayer: bool = true)
bool can_switch_app(app: RunningApp)
bool is_running(app_name: String)
void check_running()

Property Descriptions

gamescope

GamescopeInstance gamescope

Note

There is currently no description for this property. Please help us by contributing one!

input_plumber

InputPlumberInstance input_plumber

Note

There is currently no description for this property. Please help us by contributing one!

state_machine

StateMachine state_machine

Note

There is currently no description for this property. Please help us by contributing one!

in_game_state

State in_game_state

Note

There is currently no description for this property. Please help us by contributing one!

in_game_menu_state

State in_game_menu_state

Note

There is currently no description for this property. Please help us by contributing one!

PID

int PID

Note

There is currently no description for this property. Please help us by contributing one!

should_manage_overlay

bool should_manage_overlay = true

Note

There is currently no description for this property. Please help us by contributing one!

logger

CustomLogger logger

Note

There is currently no description for this property. Please help us by contributing one!


Method Descriptions

setup()

void setup(input_manager: InputManager)

Note

There is currently no description for this method. Please help us by contributing one!

launch()

RunningApp launch(app: LibraryLaunchItem)

Launches the given application and switches to the in-game state. Returns a RunningApp instance of the application.

launch_in_background()

RunningApp launch_in_background(app: LibraryLaunchItem)

Launches the given app in the background. Returns the RunningApp instance.

stop()

void stop(app: RunningApp)

Stops the game and all its children with the given PID

get_recent_apps()

Array get_recent_apps()

Returns a list of apps that have been launched recently

update_recent_apps()

void update_recent_apps(app: LibraryLaunchItem)

Note

There is currently no description for this method. Please help us by contributing one!

get_running()

RunningApp[] get_running()

Returns a list of currently running apps

get_running_background()

RunningApp[] get_running_background()

Returns a list of currently running background apps

get_running_from_window_id()

RunningApp get_running_from_window_id(window_id: int)

Returns the running app from the given window id

get_current_app()

RunningApp get_current_app()

Returns the currently running app

get_current_app_library_item()

LibraryItem get_current_app_library_item()

Returns the library item for the currently running app (if one is running).

set_app_gamepad_profile()

void set_app_gamepad_profile(app: RunningApp)

Sets the gamepad profile for the running app with the given profile

set_gamepad_profile()

void set_gamepad_profile(profile_path: String, target_gamepad: String = "")

Sets the gamepad profile for the running app with the given profile

set_current_app()

void set_current_app(app: RunningApp, _switch_baselayer: bool = true)

Sets the given running app as the current app

can_switch_app()

bool can_switch_app(app: RunningApp)

Returns true if the given app can be switched to via Gamescope

is_running()

bool is_running(app_name: String)

Returns whether the given app is running

check_running()

void check_running()

Note

There is currently no description for this method. Please help us by contributing one!