11use cicada_core:: auth:: oauth:: OAuthClient ;
22use cicada_core:: auth:: MemoryStorage ;
3- use cicada_core:: config:: { self } ;
3+ use cicada_core:: config;
44use commands:: auth:: AuthState ;
5- use tauri:: { Emitter , Manager } ;
5+ use tauri:: Manager ;
66
77mod autostart;
88mod commands;
@@ -13,10 +13,6 @@ mod windows;
1313fn main ( ) {
1414 let config = config:: load_config ( ) ;
1515
16- if config. behavior . auto_start && !autostart:: is_autostart_enabled ( ) {
17- let _ = autostart:: enable_autostart ( ) ;
18- }
19-
2016 let oauth_client = OAuthClient :: new (
2117 config. connection . client_id . clone ( ) ,
2218 "https://appwrite.sectl.cn" . to_string ( ) ,
@@ -30,10 +26,7 @@ fn main() {
3026 } ;
3127
3228 tauri:: Builder :: default ( )
33- . plugin ( tauri_plugin_shell:: init ( ) )
34- . plugin ( tauri_plugin_process:: init ( ) )
3529 . manage ( auth_state)
36- . manage ( config. clone ( ) )
3730 . invoke_handler ( tauri:: generate_handler![
3831 commands:: auth:: start_login,
3932 commands:: auth:: complete_login,
@@ -48,41 +41,8 @@ fn main() {
4841 commands:: mode:: get_mode,
4942 commands:: build_info:: get_build_info,
5043 ] )
51- . setup ( move |app| {
52- let window = app
53- . get_webview_window ( "main" )
54- . expect ( "main window not found" ) ;
55-
56- let ds = & config. display ;
57- if ds. window_width > 0 && ds. window_height > 0 {
58- let _ = window. set_size ( tauri:: Size :: Logical ( tauri:: LogicalSize {
59- width : ds. window_width as f64 ,
60- height : ds. window_height as f64 ,
61- } ) ) ;
62- }
63-
64- if ds. window_position_x >= 0 && ds. window_position_y >= 0 {
65- let _ = window. set_position ( tauri:: Position :: Logical ( tauri:: LogicalPosition {
66- x : ds. window_position_x as f64 ,
67- y : ds. window_position_y as f64 ,
68- } ) ) ;
69- }
70-
71- let _ = window. set_always_on_top ( config. behavior . floating_topmost ) ;
72-
73- if config. behavior . start_minimized {
74- let _ = window. hide ( ) ;
75- } else {
76- let _ = window. show ( ) ;
77- }
78-
79- let default_mode = config. behavior . default_mode . clone ( ) ;
80- if !default_mode. is_empty ( ) {
81- let _ = window. emit ( "mode-changed" , & default_mode) ;
82- }
83-
84- let _ = tray:: build ( app. handle ( ) ) ?;
85-
44+ . setup ( |app| {
45+ let _window = app. get_window ( "main" ) . expect ( "main window not found" ) ;
8646 Ok ( ( ) )
8747 } )
8848 . run ( tauri:: generate_context!( ) )
0 commit comments