Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Update crates, parse launch args
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Aug 25, 2022
1 parent 688738d commit 5e82162
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 27 deletions.
42 changes: 22 additions & 20 deletions core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.5", features = ["api-all", "system-tray"] }
window-vibrancy = "0.1.3"
auto-launch = { git = "https://github.com/zzzgydi/auto-launch", branch = "main" }
sysinfo = "0.20.2"
auto-launch = "0.3.0"
sysinfo = "0.25.3"
argon2 = "0.4"
rand_core = { version = "0.6", features = ["std"] }

Expand Down
19 changes: 17 additions & 2 deletions core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
)]
#![allow(dead_code, unused_imports, unused_variables)]

use std::env;
use tauri::*;
use window_vibrancy::{apply_mica, apply_vibrancy, NSVisualEffectMaterial};

Expand Down Expand Up @@ -83,6 +84,7 @@ fn main() {
.setup(|app| {
let win = app.get_window("main").unwrap();

// Transparent effects
#[cfg(target_os = "macos")]
apply_vibrancy(&win, NSVisualEffectMaterial::AppearanceBased)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
Expand All @@ -92,9 +94,22 @@ fn main() {
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");

let window = win.get_window("main").unwrap();
let args: Vec<String> = env::args().collect();

// Show window if auto launch argument not detected
if args.len() >= 2 {
if args[1] != "--minimized" {
window.maximize().unwrap();
window.show().unwrap();
window.set_focus().unwrap();
}
} else {
window.maximize().unwrap();
window.show().unwrap();
window.set_focus().unwrap();
}

window.maximize().unwrap();
window.set_focus().unwrap();
// Temporary fix for transparency
window.set_decorations(true).unwrap();

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions core/src/system_info.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use sysinfo::{ProcessorExt, System, SystemExt};
use sysinfo::{CpuExt, System, SystemExt};

#[tauri::command]
pub fn system_info() -> String {
let mut sys = System::new_all();

sys.refresh_all();

let cpu = sys.processors()[0].brand();
let cpu = sys.cpus()[0].brand();
let mem = sys.total_memory();

let returning = format!("{}+{}", cpu, mem);
Expand Down
3 changes: 2 additions & 1 deletion core/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"minHeight": 600,
"maximized": true,
"transparent": true,
"decorations": false
"decorations": false,
"visible": false
}
]
}
Expand Down

0 comments on commit 5e82162

Please sign in to comment.