mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
feat: set window size (#405)
This commit is contained in:
@@ -62,7 +62,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
.title("ChatGPT")
|
||||
.resizable(true)
|
||||
.fullscreen(false)
|
||||
.inner_size(800.0, 600.0)
|
||||
.inner_size(app_conf2.main_width, app_conf2.main_height)
|
||||
.theme(Some(theme))
|
||||
.always_on_top(app_conf2.stay_on_top)
|
||||
.initialization_script(&utils::user_script())
|
||||
|
||||
@@ -18,7 +18,7 @@ pub fn tray_window(handle: &tauri::AppHandle) {
|
||||
.title("ChatGPT")
|
||||
.resizable(false)
|
||||
.fullscreen(false)
|
||||
.inner_size(360.0, 540.0)
|
||||
.inner_size(app_conf.tray_width, app_conf.tray_height)
|
||||
.decorations(false)
|
||||
.always_on_top(true)
|
||||
.theme(Some(theme))
|
||||
|
||||
@@ -34,20 +34,29 @@ pub_struct!(AppConf {
|
||||
// macOS and Windows: light / dark / system
|
||||
theme: String,
|
||||
// auto update policy: prompt / silent / disable
|
||||
isinit: bool,
|
||||
main_close: bool,
|
||||
auto_update: String,
|
||||
tray: bool,
|
||||
popup_search: bool,
|
||||
stay_on_top: bool,
|
||||
main_dashboard: bool,
|
||||
tray_dashboard: bool,
|
||||
main_origin: String,
|
||||
tray_origin: String,
|
||||
default_origin: String,
|
||||
ua_window: String,
|
||||
ua_tray: String,
|
||||
save_window_state: bool,
|
||||
global_shortcut: Option<String>,
|
||||
default_origin: String,
|
||||
|
||||
// Main Window
|
||||
isinit: bool,
|
||||
popup_search: bool,
|
||||
main_close: bool,
|
||||
main_dashboard: bool,
|
||||
main_origin: String,
|
||||
ua_window: String,
|
||||
main_width: f64,
|
||||
main_height: f64,
|
||||
|
||||
// Tray Window
|
||||
tray_width: f64,
|
||||
tray_height: f64,
|
||||
tray: bool,
|
||||
tray_dashboard: bool,
|
||||
tray_origin: String,
|
||||
ua_tray: String,
|
||||
});
|
||||
|
||||
impl AppConf {
|
||||
@@ -56,6 +65,7 @@ impl AppConf {
|
||||
Self {
|
||||
titlebar: !cfg!(target_os = "macos"),
|
||||
hide_dock_icon: false,
|
||||
save_window_state: false,
|
||||
theme: "light".into(),
|
||||
auto_update: "prompt".into(),
|
||||
tray: true,
|
||||
@@ -65,6 +75,10 @@ impl AppConf {
|
||||
stay_on_top: false,
|
||||
main_dashboard: false,
|
||||
tray_dashboard: false,
|
||||
main_width: 800.0,
|
||||
main_height: 600.0,
|
||||
tray_width: 360.0,
|
||||
tray_height: 540.0,
|
||||
main_origin: CHATGPT_URL.into(),
|
||||
tray_origin: CHATGPT_URL.into(),
|
||||
default_origin: CHATGPT_URL.into(),
|
||||
|
||||
@@ -52,7 +52,6 @@ async fn main() {
|
||||
MacosLauncher::LaunchAgent,
|
||||
None,
|
||||
))
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
cmd::drag_window,
|
||||
cmd::fullscreen,
|
||||
@@ -88,6 +87,10 @@ async fn main() {
|
||||
builder = builder.system_tray(menu::tray_menu());
|
||||
}
|
||||
|
||||
if app_conf.save_window_state {
|
||||
builder = builder.plugin(tauri_plugin_window_state::Builder::default().build());
|
||||
}
|
||||
|
||||
builder
|
||||
.on_menu_event(menu::menu_handler)
|
||||
.on_system_tray_event(menu::tray_handler)
|
||||
|
||||
Reference in New Issue
Block a user