diff --git a/frontend/assets/icons/GitpubDesktop-Icon.ico b/frontend/assets/icons/GitpubDesktop-Icon.ico new file mode 100644 index 0000000..734b08a Binary files /dev/null and b/frontend/assets/icons/GitpubDesktop-Icon.ico differ diff --git a/frontend/css/components.css b/frontend/css/components.css index 5b489a1..ffcf13b 100644 --- a/frontend/css/components.css +++ b/frontend/css/components.css @@ -174,7 +174,15 @@ flex: 1; display: flex; align-items: center; + gap: 14px; padding: 0 18px; + min-width: 0; +} + +.gd-toolbar-drag-space { + align-self: stretch; + flex: 1; + min-width: 40px; } /* Right section – view toggle + utility menu */ @@ -187,6 +195,38 @@ flex-shrink: 0; } +.gd-window-controls { + display: flex; + align-items: stretch; + flex-shrink: 0; + border-left: 1px solid rgba(229, 161, 62, 0.12); +} + +.gd-window-control { + display: inline-flex; + align-items: center; + justify-content: center; + width: 46px; + height: 100%; + padding: 0; + border: 0; + border-radius: 0; + background: transparent; + color: var(--text-muted); + cursor: pointer; + transition: background 0.12s ease, color 0.12s ease; +} + +.gd-window-control:hover { + background: rgba(229, 161, 62, 0.1); + color: var(--text-main); +} + +.gd-window-close:hover { + background: var(--danger); + color: #ffffff; +} + .gd-external-actions { display: flex; align-items: center; diff --git a/frontend/js/app.js b/frontend/js/app.js index 22bb565..84a3fb4 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -66,6 +66,53 @@ const PUSH_ICON = ``; const EXPLORER_ICON = ``; const EDITOR_ICON = ``; +const WINDOW_MINIMIZE_ICON = ``; +const WINDOW_MAXIMIZE_ICON = ``; +const WINDOW_CLOSE_ICON = ``; + +function currentTauriWindow() { + const tauriWindow = window.__TAURI__?.window; + if (tauriWindow?.getCurrentWindow) { + return tauriWindow.getCurrentWindow(); + } + return tauriWindow?.appWindow || null; +} + +async function handleWindowAction(action) { + const appWindow = currentTauriWindow(); + if (!appWindow) { + console.warn("Tauri window API not available"); + return; + } + + try { + if (action === "minimize") { + await appWindow.minimize(); + } else if (action === "maximize") { + const isMaximized = await appWindow.isMaximized(); + if (isMaximized) { + await appWindow.unmaximize(); + } else { + await appWindow.maximize(); + } + } else if (action === "close") { + await appWindow.close(); + } + } catch (error) { + console.error(`Unable to ${action} window:`, error); + } +} + +async function startWindowDrag() { + const appWindow = currentTauriWindow(); + if (!appWindow) return; + + try { + await appWindow.startDragging(); + } catch (error) { + console.error("Unable to start window drag:", error); + } +} function uid() { return `${Date.now()}-${Math.random().toString(16).slice(2)}`; @@ -1176,6 +1223,7 @@ function dashboardView() { ${escapeHtml(syncCfg.subLabel)} +
@@ -1229,6 +1277,11 @@ function dashboardView() {
` : ""} +
+ + + +
`; // ── Sidebar content ───────────────────────────────────────────────────── @@ -2065,6 +2118,11 @@ function bindDashboardEvents() { document.getElementById("open-file-explorer-menu-btn")?.addEventListener("click", openSelectedRepoInFileExplorer); document.getElementById("open-code-editor-btn")?.addEventListener("click", openSelectedRepoInCodeEditor); document.getElementById("open-code-editor-menu-btn")?.addEventListener("click", openSelectedRepoInCodeEditor); + document.querySelectorAll("[data-window-action]").forEach((button) => { + button.addEventListener("click", () => handleWindowAction(button.dataset.windowAction || "")); + }); + document.querySelector(".gd-toolbar-drag-space")?.addEventListener("mousedown", startWindowDrag); + document.querySelector(".gd-toolbar-drag-space")?.addEventListener("dblclick", () => handleWindowAction("maximize")); // Modal close document.getElementById("modal-close-btn")?.addEventListener("click", () => { diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 01a4101..fee7e4e 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -5,6 +5,13 @@ "windows": ["main"], "permissions": [ "core:default", + "core:window:allow-minimize", + "core:window:allow-maximize", + "core:window:allow-unmaximize", + "core:window:allow-toggle-maximize", + "core:window:allow-close", + "core:window:allow-is-maximized", + "core:window:allow-start-dragging", "dialog:default", "opener:default" ] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e5f359f..2b2cac4 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,7 +14,8 @@ "width": 1320, "height": 860, "minWidth": 1024, - "minHeight": 680 + "minHeight": 680, + "decorations": false } ], "security": { @@ -29,7 +30,7 @@ "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", - "icons/icon.ico" + "../frontend/assets/icons/GitpubDesktop-Icon.ico" ] } }