Skip to content

Commit

Permalink
initializing single instance plugin only if no profile specified via …
Browse files Browse the repository at this point in the history
…the command line
  • Loading branch information
matthme committed Oct 10, 2023
1 parent 5b10247 commit 92de83b
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ fn main() {
_ => {}
})

// optional (single-instance) -- Allows only a single instance of your app running. Useful in combination with the systray
.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
let main_window = app.get_window("main");
if let Some(window) = main_window {
window.show().unwrap();
window.unminimize().unwrap();
window.set_focus().unwrap();
} else {
let fs = app.state::<AppFileSystem>().inner().to_owned();
let (app_port, admin_port) = app.state::<(u16, u16)>().inner().to_owned();
let _r = build_main_window(fs, app, app_port, admin_port);
}
}))

.invoke_handler(tauri::generate_handler![
sign_zome_call,
log,
Expand All @@ -100,6 +86,22 @@ fn main() {
let profile = match profile_from_cli {
Some(profile) => profile,
None => {
// ========================================
// optional (single-instance) -- Allows only a single instance of your app running. Useful in combination with the systray
handle.plugin(tauri_plugin_single_instance::init(move |app, _argv, _cwd| {
let main_window = app.get_window("main");
if let Some(window) = main_window {
window.show().unwrap();
window.unminimize().unwrap();
window.set_focus().unwrap();
} else {
let fs = app.state::<AppFileSystem>().inner().to_owned();
let (app_port, admin_port) = app.state::<(u16, u16)>().inner().to_owned();
let _r = build_main_window(fs, app, app_port, admin_port);
}
}))?;
// ========================================

let fs_tmp = AppFileSystem::new(&handle, &String::from("default"))?;
fs_tmp.get_active_profile()
},
Expand Down

0 comments on commit 92de83b

Please sign in to comment.