Skip to content

Commit

Permalink
fix(all): codefix
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Sep 9, 2023
1 parent 66f8f46 commit b592fe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct Config {
pub streamer_mode_detection: Option<bool>,
pub rpc_server: Option<bool>,
pub open_on_startup: Option<bool>,
pub startup_minimized: Option<bool>
pub startup_minimized: Option<bool>,
}

pub fn init() {
Expand Down Expand Up @@ -61,7 +61,7 @@ pub fn default_config() -> Config {
streamer_mode_detection: Option::from(false),
rpc_server: Option::from(false),
open_on_startup: Option::from(false),
startup_minimized: Option::from(false)
startup_minimized: Option::from(false),
}
}

Expand Down Expand Up @@ -154,4 +154,4 @@ pub fn get_startup_minimize() -> bool {
let parsed: Config =
serde_json::from_str(read_config_file().as_str()).unwrap_or_else(|_| default_config());
parsed.startup_minimized.unwrap_or(false)
}
}
14 changes: 6 additions & 8 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
windows_subsystem = "windows"
)]

use std::time::Duration;
use auto_launch::*;
use std::time::Duration;

use config::{get_client_type, get_start_maximized};
use injection::{injection_runner, local_html, plugin, theme};
Expand Down Expand Up @@ -256,12 +256,10 @@ fn modify_window(window: &Window) {
let startup = std::env::args().any(|arg| arg == "--startup");

// If we are opening on startup (which we know from the --startup arg), check to minimize the window
if startup {
if config::get_startup_minimize() {
window.hide().unwrap_or_default();
}
if startup && config::get_startup_minimize() {
window.hide().unwrap_or_default();
}

if get_start_maximized() {
window.maximize().unwrap_or_default();
}
Expand All @@ -274,8 +272,8 @@ fn setup_autostart(app: &mut tauri::App) {
let current_exe = std::env::current_exe().unwrap();

let autolaunch = AutoLaunchBuilder::new()
.set_app_name(&app_name)
.set_app_path(&current_exe.to_str().unwrap())
.set_app_name(app_name)
.set_app_path(current_exe.to_str().unwrap())
.set_use_launch_agent(true)
.set_args(&["--startup"])
.build()
Expand Down

0 comments on commit b592fe0

Please sign in to comment.