window: the tabs and buttons in the header are plain clicks — only the header's empty space drags the window, instead of a native strip that dragged from anywhere across the top

This commit is contained in:
yetone
2026-09-24 15:27:35 +08:00
parent e00083a3f7
commit 4445d94042
2 changed files with 15 additions and 9 deletions
+11 -9
View File
@@ -3,8 +3,8 @@ package gui
import (
"context"
"crypto/sha256"
"encoding/hex"
_ "embed"
"encoding/hex"
"log"
"os"
"runtime"
@@ -57,6 +57,7 @@ func (h *host) ShowMain(view string) {
h.main.Show()
h.main.Focus()
}
// Import opens the window on an import link, for the user to confirm.
func (h *host) Import(link string) {
id := stashImport(link)
@@ -149,12 +150,12 @@ func Run(version string, showMain bool, link string) error {
// second launch); it hands its arguments to the running one and quits.
// The Mac sends the link to the running app itself.
SingleInstance: singleInstance(h),
Name: "magpie",
Description: "one place to pick every agent's model",
Icon: appIcon,
Assets: application.AssetOptions{Handler: Handler(h, gw)},
Mac: application.MacOptions{ActivationPolicy: application.ActivationPolicyAccessory},
Windows: application.WindowsOptions{DisableQuitOnLastWindowClosed: true},
Name: "magpie",
Description: "one place to pick every agent's model",
Icon: appIcon,
Assets: application.AssetOptions{Handler: Handler(h, gw)},
Mac: application.MacOptions{ActivationPolicy: application.ActivationPolicyAccessory},
Windows: application.WindowsOptions{DisableQuitOnLastWindowClosed: true},
// A version downloaded but not restarted into is installed on the
// way out, so the next launch is the new one.
OnShutdown: func() { updates.install() },
@@ -192,8 +193,9 @@ func Run(version string, showMain bool, link string) error {
MinHeight: 420,
Hidden: true,
Mac: application.MacWindow{
TitleBar: application.MacTitleBarHiddenInset,
InvisibleTitleBarHeight: 50,
// no InvisibleTitleBarHeight: that strip drags from anywhere in
// it, tabs included; the header marks what drags instead
TitleBar: application.MacTitleBarHiddenInset,
},
})
// Closing the window keeps the tray alive; quitting is a menu action.
+4
View File
@@ -6,6 +6,10 @@ const mode = params.get("mode") || "window";
document.body.classList.add(mode);
// Only the Mac window draws its title bar inside the page (the traffic lights).
if (/^Mac/.test(navigator.platform)) document.body.classList.add("mac");
// The window is dragged by its header, and only where the header says so
// (--wails-draggable), so the tabs and buttons in it stay plain clicks.
// Outside the app — a browser on the gateway's page — there is no runtime.
if (mode === "window") import("/wails/runtime.js").catch(() => {});
if (params.get("theme")) document.documentElement.dataset.theme = params.get("theme");
let state = { agents: [], profiles: [], catalog: "", settings: {} };