@@ -526,6 +526,29 @@ impl LauncherApp {
526526 self . error = Some ( msg) ;
527527 self . error_time = Some ( Instant :: now ( ) ) ;
528528 }
529+
530+ fn open_settings_dialog ( & mut self ) {
531+ if !self . show_settings {
532+ match Settings :: load ( & self . settings_path ) {
533+ Ok ( settings) => {
534+ self . settings_editor = SettingsEditor :: new_with_plugins ( & settings) ;
535+ }
536+ Err ( e) => {
537+ let msg = format ! ( "Failed to load settings: {e}" ) ;
538+ self . set_error ( msg. clone ( ) ) ;
539+ if self . enable_toasts {
540+ self . add_toast ( Toast {
541+ text : msg. into ( ) ,
542+ kind : ToastKind :: Error ,
543+ options : ToastOptions :: default ( )
544+ . duration_in_seconds ( self . toast_duration as f64 ) ,
545+ } ) ;
546+ }
547+ }
548+ }
549+ }
550+ self . show_settings = true ;
551+ }
529552 pub fn update_paths (
530553 & mut self ,
531554 plugin_dirs : Option < Vec < String > > ,
@@ -1554,7 +1577,7 @@ impl LauncherApp {
15541577 } else if a. action == "tempfile:dialog" {
15551578 self . tempfile_dialog . open ( ) ;
15561579 } else if a. action == "settings:dialog" {
1557- self . show_settings = true ;
1580+ self . open_settings_dialog ( ) ;
15581581 } else if a. action == "dashboard:settings" {
15591582 let registry = self . dashboard . registry ( ) . clone ( ) ;
15601583 self . dashboard_editor . open ( & self . dashboard_path , & registry) ;
@@ -2252,7 +2275,7 @@ impl LauncherApp {
22522275 Panel :: CpuListDialog => self . cpu_list_dialog . open = true ,
22532276 Panel :: ToastLogDialog => self . toast_log_dialog . open = true ,
22542277 Panel :: Editor => self . show_editor = true ,
2255- Panel :: Settings => self . show_settings = true ,
2278+ Panel :: Settings => self . open_settings_dialog ( ) ,
22562279 Panel :: Plugins => self . show_plugins = true ,
22572280 }
22582281 if !self . panel_stack . contains ( & panel) {
0 commit comments