File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,7 +192,8 @@ fn main() {
192192 updater:: install_update,
193193 updater:: get_current_version,
194194 config:: get_refresh_interval,
195- config:: set_refresh_interval
195+ config:: set_refresh_interval,
196+ window:: minimize_window
196197 ] )
197198 . run ( tauri:: generate_context!( ) )
198199 . expect ( "error while running tauri application" ) ;
Original file line number Diff line number Diff line change @@ -79,3 +79,12 @@ pub fn set_macos_window_level(window: &tauri::WebviewWindow) {
7979pub fn set_macos_window_level ( _window : & tauri:: WebviewWindow ) {
8080 // No-op on non-macOS platforms
8181}
82+
83+ // ============================================================================
84+ // Window Control Commands
85+ // ============================================================================
86+
87+ #[ tauri:: command]
88+ pub fn minimize_window ( window : tauri:: WebviewWindow ) -> Result < ( ) , String > {
89+ window. hide ( ) . map_err ( |e| format ! ( "Failed to hide window: {}" , e) )
90+ }
Original file line number Diff line number Diff line change 4848 >
4949 < i class ="ti ti-settings "> </ i >
5050 </ button >
51+ < button
52+ class ="icon-btn "
53+ (click) ="minimizeApp() "
54+ title ="Minimize "
55+ >
56+ < i class ="ti ti-minus "> </ i >
57+ </ button >
5158 </ div >
5259</ div >
Original file line number Diff line number Diff line change 5959 padding : 6px 8px ;
6060 border-radius : 4px ;
6161 font-size : 18px ;
62- transition : all 0.2s ;
62+ transition : background-color 0.2 s , color 0.2s ;
6363 display : flex ;
6464 align-items : center ;
6565 justify-content : center ;
Original file line number Diff line number Diff line change @@ -79,4 +79,13 @@ export class HeaderComponent implements OnInit, OnDestroy {
7979 showSettings ( ) : void {
8080 this . viewChange . emit ( 'settings' ) ;
8181 }
82+
83+ async minimizeApp ( ) : Promise < void > {
84+ try {
85+ const { invoke } = await import ( '@tauri-apps/api/core' ) ;
86+ await invoke ( 'minimize_window' ) ;
87+ } catch ( error ) {
88+ console . error ( 'Failed to minimize window:' , error ) ;
89+ }
90+ }
8291}
You can’t perform that action at this time.
0 commit comments