Skip to content

RunningApp

Inherits: Resource

Defines a running application

Description

RunningApp contains details and methods around running applications

Properties

Type Name Default
GamescopeInstance gamescope
LibraryLaunchItem launch_item
int pid
String display
PackedStringArray command
Dictionary environment
int state 0
int state_steam 0
int steam_missing_window_timestamp
bool is_suspended false
int start_time
PackedInt64Array window_ids PackedInt64Array()
int last_focused_window_id
String ogui_id
int app_id
int app_type 0
bool focused false
bool created_window false
int num_created_windows 0
int not_running_count 0
bool is_ogui_managed true
CustomLogger logger

Methods

Returns Signature
RunningApp create(app: LibraryLaunchItem, env: Dictionary, cmd: String, args: PackedStringArray)
RunningApp spawn(app: LibraryLaunchItem, env: Dictionary, cmd: String, args: PackedStringArray)
void start()
void update(all_windows: PackedInt64Array, app_pids: PackedInt64Array)
int discover_app_type(all_windows: PackedInt64Array, app_pids: PackedInt64Array)
void update_wayland_app(app_pids: PackedInt64Array)
void update_xwayland_app(all_windows: PackedInt64Array, app_pids: PackedInt64Array)
void update_steam_xwayland_app(app_pids: PackedInt64Array)
void suspend(enable: bool)
String get_window_title(win_id: int)
int get_window_id_from_pid()
PackedInt64Array get_all_window_ids(all_windows: PackedInt64Array, app_pids: PackedInt64Array)
bool is_running()
bool is_focused()
void grab_focus()
int switch_window(win_id: int, focus: bool = true)
void kill(sig: int = 15)
bool is_steam_app()
bool is_steam_window(window_id: int)
int find_steam(app_pids: PackedInt64Array)

Property Descriptions

gamescope

GamescopeInstance gamescope

Note

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

launch_item

LibraryLaunchItem launch_item

The LibraryLaunchItem associated with the running application

pid

int pid

The PID of the launched application

display

String display

The xwayland display that the application is running on (e.g. ":1")

command

PackedStringArray command

The raw command that was used to launch the application

environment

Dictionary environment

Environment variables that were set with the launched application

state

int state = 0

The state of the running app

state_steam

int state_steam = 0

Note

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

steam_missing_window_timestamp

int steam_missing_window_timestamp

Note

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

is_suspended

bool is_suspended = false

Whether or not the running app is suspended

start_time

int start_time

Time in milliseconds when the app started

window_ids

PackedInt64Array window_ids = PackedInt64Array()

A list of all detected window IDs related to the application

last_focused_window_id

int last_focused_window_id

The window id of the last focused window

ogui_id

String ogui_id

The identifier that is set as the OGUI_ID environment variable

app_id

int app_id

The current app ID of the application

app_type

int app_type = 0

The type of app

focused

bool focused = false

Whether or not the app is currently focused

created_window

bool created_window = false

Whether or not the running app has created at least one valid window

num_created_windows

int num_created_windows = 0

The number of windows that have been discovered from this app

not_running_count

int not_running_count = 0

Number of times this app has failed its "is_running" check

is_ogui_managed

bool is_ogui_managed = true

Flag for if OGUI should manage this app. Set to false if app is launched outside OGUI and we just want to track it.

logger

CustomLogger logger

Note

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


Method Descriptions

create()

RunningApp create(app: LibraryLaunchItem, env: Dictionary, cmd: String, args: PackedStringArray)

Create a RunningApp with the given command without starting it.

spawn()

RunningApp spawn(app: LibraryLaunchItem, env: Dictionary, cmd: String, args: PackedStringArray)

Run the given command and return it as a RunningApp

start()

void start()

Start the running app

update()

void update(all_windows: PackedInt64Array, app_pids: PackedInt64Array)

Updates the state of the running app and fires signals using the given list of window ids from XWayland and list of process ids that match the OGUI_ID of this application.

discover_app_type()

int discover_app_type(all_windows: PackedInt64Array, app_pids: PackedInt64Array)

Tries to discover if the launched app is an X11 or Wayland application

update_wayland_app()

void update_wayland_app(app_pids: PackedInt64Array)

Note

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

update_xwayland_app()

void update_xwayland_app(all_windows: PackedInt64Array, app_pids: PackedInt64Array)

Note

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

update_steam_xwayland_app()

void update_steam_xwayland_app(app_pids: PackedInt64Array)

Note

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

suspend()

void suspend(enable: bool)

Pauses/Resumes the running app by running 'kill -STOP' or 'kill -CONT'

get_window_title()

String get_window_title(win_id: int)

Returns the window title of the given window. If the window ID does not belong to this app, it will return an empty string.

get_window_id_from_pid()

int get_window_id_from_pid()

Attempt to discover the window ID from the PID of the given application

get_all_window_ids()

PackedInt64Array get_all_window_ids(all_windows: PackedInt64Array, app_pids: PackedInt64Array)

Attempt to discover all window IDs from the PID of the given application and the PIDs of all processes in the same process group.

is_running()

bool is_running()

Returns true if the app's PID is running or any decendents with the same process group.

is_focused()

bool is_focused()

Return true if the currently running app is focused

grab_focus()

void grab_focus()

Focuses to the app's window

switch_window()

int switch_window(win_id: int, focus: bool = true)

Switches the app window to the given window ID. Returns an error if unable to switch to the window

kill()

void kill(sig: int = 15)

Kill the running app

is_steam_app()

bool is_steam_app()

Returns true if the running app was launched through Steam

is_steam_window()

bool is_steam_window(window_id: int)

Returns true if the given window id is detected as a Steam window

find_steam()

int find_steam(app_pids: PackedInt64Array)

Finds the steam process so it can be killed when a game closes