Skip to content

Commit 92bd3d1

Browse files
stephanebougetCopilot
andcommitted
feat: add minimize window functionality and update header component
Co-authored-by: Copilot <copilot@github.com>
1 parent cf8a9fd commit 92bd3d1

5 files changed

Lines changed: 28 additions & 2 deletions

File tree

src-tauri/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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");

src-tauri/src/window.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,12 @@ pub fn set_macos_window_level(window: &tauri::WebviewWindow) {
7979
pub 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+
}

src/app/shared/components/header/header.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,12 @@
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>

src/app/shared/components/header/header.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
padding: 6px 8px;
6060
border-radius: 4px;
6161
font-size: 18px;
62-
transition: all 0.2s;
62+
transition: background-color 0.2s, color 0.2s;
6363
display: flex;
6464
align-items: center;
6565
justify-content: center;

src/app/shared/components/header/header.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)