Remember Window state #199

This commit is contained in:
Prayag Prajapati committed 2023-10-07 16:56:30 +05:30
1 parent 1125ef2539
commit 8c9e5aec18
5 files changed
+32 -31

No files matched your search

+1
View File
@@ -22,6 +22,7 @@ tauri = { version = "1.5.1", features = [ "http-all", "devtools", "process-exit"
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev", features = ["colored"] }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
portpicker = "0.1" # used in the example to pick a random free port
[features]
+1 -17
View File
@@ -1,20 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use tauri::Manager;
use tauri::{utils::config::AppUrl, WindowUrl};
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, LogTarget};
// Create the command:
// This command must be async so that it doesn't run on the main thread.
#[tauri::command]
async fn close_splashscreen(window: tauri::Window) {
// Close splashscreen
if let Some(splashscreen) = window.get_window("splashscreen") {
splashscreen.close().unwrap();
}
// Show main window
window.get_window("main").unwrap().show().unwrap();
}
// Tauri by default uses HTTPS, so use the localhost plugin to downgrade back to
// HTTP. However, when running tauri dev, we already have a localhost server
// provided by vite, so don't enable it
@@ -52,10 +39,7 @@ fn main() {
.build(),
)
.plugin(tauri_plugin_store::Builder::default().build())
.invoke_handler(tauri::generate_handler![close_splashscreen])
.plugin(tauri_plugin_window_state::Builder::default().build())
.run(context)
.expect("error while running JellyPlayer");
// tauri::Builder::default()
// .run(tauri::generate_context!())
// .expect("error while running tauri application");
}
+1 -14
View File
@@ -96,26 +96,13 @@
"active": false
},
"windows": [
{
"width": 800,
"height": 300,
"center": true,
"decorations": false,
"resizable": false,
"url": "splash.html",
"label": "splashscreen",
"title": "JellyPlayer",
"visible": true,
"transparent": true
},
{
"fullscreen": false,
"height": 600,
"width": 800,
"resizable": true,
"title": "JellyPlayer",
"visible": false,
"visible": true,
"center": true,
"label": "main"
}