@@ -349,4 +349,51 @@ fn main_loop(
349349
350350 Cmd :: CheckForUpdates => {
351351 let cfg = config_shared. lock ( ) . unwrap ( ) . clone ( ) ;
352- updater:: background_check( cfg. updater , cmd_t
352+ updater:: background_check ( cfg. updater , cmd_tx. clone ( ) ) ;
353+ }
354+
355+ Cmd :: Restart => {
356+ // Restore all before restarting
357+ {
358+ let mut state = state_shared. lock ( ) . unwrap ( ) ;
359+ profiles:: restore_all ( & mut state) ;
360+ }
361+ let exe = std:: env:: current_exe ( )
362+ . unwrap_or_else ( |_| std:: path:: PathBuf :: from ( "HideDesktopApps.exe" ) ) ;
363+ let _ = std:: process:: Command :: new ( exe) . spawn ( ) ;
364+ return Ok ( ( ) ) ;
365+ }
366+
367+ Cmd :: Exit => {
368+ // Restore everything cleanly before exiting
369+ let mut state = state_shared. lock ( ) . unwrap ( ) ;
370+ profiles:: restore_all ( & mut state) ;
371+ return Ok ( ( ) ) ;
372+ }
373+
374+ Cmd :: UpdateAvailable ( version) => {
375+ let cfg = config_shared. lock ( ) . unwrap ( ) . clone ( ) ;
376+ notifications:: notify_update_available ( & version, & cfg. notifications ) ;
377+ eprintln ! ( "Update available: {version}" ) ;
378+ }
379+
380+ Cmd :: HotkeyFailed ( hotkey) => {
381+ let cfg = config_shared. lock ( ) . unwrap ( ) . clone ( ) ;
382+ notifications:: notify_hotkey_failed ( & hotkey, & cfg. notifications ) ;
383+ }
384+ }
385+ }
386+ }
387+ }
388+
389+ /// Update Discord Rich Presence if enabled.
390+ fn update_discord ( state : & AppState , config : & AppConfig ) {
391+ if config. discord . enabled {
392+ discord:: set_rich_presence (
393+ state. icons_hidden ,
394+ state. taskbar_hidden ,
395+ state. windows_hidden ,
396+ state. active_profile . clone ( ) ,
397+ ) ;
398+ }
399+ }
0 commit comments