diff options
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/lib.rs | 11 | ||||
-rw-r--r-- | src-tauri/src/main.rs | 11 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 9a3cd471..61b4fb65 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -288,3 +288,14 @@ pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> { get_host_os() )) } + +use sysinfo::{System, SystemExt}; +pub fn check_origin_running() -> bool { + let s = System::new_all(); + for _process in s.processes_by_name("Origin.exe") { + // check here if this is your process + // dbg!(process); + return true; + } + false +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 97c77fa4..fd171468 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -10,7 +10,7 @@ use std::{ }; use app::{ - check_is_valid_game_path, find_game_install_location, get_host_os, + check_is_valid_game_path, check_origin_running, find_game_install_location, get_host_os, get_northstar_version_number, install_northstar, launch_northstar, GameInstall, }; use tauri::{Manager, State}; @@ -40,6 +40,15 @@ fn main() { app_handle.emit_all("backend-ping", "ping").unwrap(); } }); + let app_handle = app.app_handle(); + tauri::async_runtime::spawn(async move { + loop { + sleep(Duration::from_millis(2000)).await; + app_handle + .emit_all("origin-running-ping", check_origin_running()) + .unwrap(); + } + }); Ok(()) }) |