aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/Cargo.lock80
-rw-r--r--src-tauri/Cargo.toml2
-rw-r--r--src-tauri/src/lib.rs11
-rw-r--r--src-tauri/src/main.rs11
4 files changed, 103 insertions, 1 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index c424f1a3..b2056fac 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -86,6 +86,7 @@ dependencies = [
"serde",
"serde_json",
"steamlocate",
+ "sysinfo",
"tauri",
"tauri-build",
"tokio",
@@ -499,6 +500,31 @@ dependencies = [
]
[[package]]
+name = "crossbeam-deque"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
+dependencies = [
+ "cfg-if",
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1"
+dependencies = [
+ "autocfg",
+ "cfg-if",
+ "crossbeam-utils",
+ "memoffset",
+ "once_cell",
+ "scopeguard",
+]
+
+[[package]]
name = "crossbeam-utils"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -723,6 +749,12 @@ dependencies = [
]
[[package]]
+name = "either"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
+
+[[package]]
name = "embed-resource"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1903,6 +1935,15 @@ dependencies = [
]
[[package]]
+name = "ntapi"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2586,6 +2627,30 @@ dependencies = [
]
[[package]]
+name = "rayon"
+version = "1.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
+dependencies = [
+ "autocfg",
+ "crossbeam-deque",
+ "either",
+ "rayon-core",
+]
+
+[[package]]
+name = "rayon-core"
+version = "1.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
+dependencies = [
+ "crossbeam-channel",
+ "crossbeam-deque",
+ "crossbeam-utils",
+ "num_cpus",
+]
+
+[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3272,6 +3337,21 @@ dependencies = [
]
[[package]]
+name = "sysinfo"
+version = "0.26.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ae2421f3e16b3afd4aa692d23b83d0ba42ee9b0081d5deeb7d21428d7195fb1"
+dependencies = [
+ "cfg-if",
+ "core-foundation-sys",
+ "libc",
+ "ntapi",
+ "once_cell",
+ "rayon",
+ "winapi",
+]
+
+[[package]]
name = "system-deps"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index bc0ec64e..8a10374c 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -32,6 +32,8 @@ zip = "0.6.2"
powershell_script = "1.0.4"
# Regex
regex = "1.6.0"
+# Read out running application process names
+sysinfo = "0.26.2"
[features]
# by default Tauri runs in production mode
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(())
})