|
| 1 | +package main |
| 2 | + |
| 3 | +import "github.com/wailsapp/wails/v3/pkg/application" |
| 4 | + |
| 5 | +// The ADR-0033 second-window family: always-alive auxiliary windows |
| 6 | +// created once at startup, Hidden, shown/hidden for the app's life |
| 7 | +// (never destroyed/recreated). Split from main.go along that family |
| 8 | +// seam (the 500-line convention); main.go keeps the main window, tray, |
| 9 | +// and service wiring. |
| 10 | + |
| 11 | +// newQuickPanelWindow builds the Quick Panel (docs/adr/0033): a |
| 12 | +// floating window the summon hotkey toggles. URL is a hash route, not |
| 13 | +// a bare path: production asset serving has no SPA fallback, so a bare |
| 14 | +// path second window would 404 in a real installed build. Deliberately |
| 15 | +// NOT ActivationPolicyAccessory (would pull Mill's dock icon too) and |
| 16 | +// NOT a non-activating NSPanel (unmerged upstream at beta.4) -- |
| 17 | +// showing this window still activates Mill and steals focus, which |
| 18 | +// SettingsService's yieldFocusIfMainHidden mitigates on dismiss. |
| 19 | +func newQuickPanelWindow(app *application.App) *application.WebviewWindow { |
| 20 | + return app.Window.NewWithOptions(application.WebviewWindowOptions{ |
| 21 | + Name: "quickpanel", |
| 22 | + Title: "Mill Quick Panel", |
| 23 | + Width: 560, |
| 24 | + Height: 400, |
| 25 | + Hidden: true, |
| 26 | + Frameless: true, |
| 27 | + DisableResize: true, |
| 28 | + InitialPosition: application.WindowCentered, |
| 29 | + HideOnFocusLost: true, |
| 30 | + HideOnEscape: true, |
| 31 | + BackgroundColour: application.NewRGB(6, 7, 15), |
| 32 | + Mac: application.MacWindow{ |
| 33 | + Backdrop: application.MacBackdropTranslucent, |
| 34 | + WindowLevel: application.MacWindowLevelFloating, |
| 35 | + CollectionBehavior: application.MacWindowCollectionBehaviorCanJoinAllSpaces | application.MacWindowCollectionBehaviorFullScreenAuxiliary, |
| 36 | + TitleBar: application.MacTitleBar{ |
| 37 | + AppearsTransparent: true, |
| 38 | + Hide: true, |
| 39 | + }, |
| 40 | + }, |
| 41 | + URL: "/#/quickpanel", |
| 42 | + }) |
| 43 | +} |
| 44 | + |
| 45 | +// newApprovalPromptWindow builds the floating approval prompt |
| 46 | +// (docs/goals/0023-attention-escalation.md item 1): the incoming-call/ |
| 47 | +// askpass pattern, ADR-0033's second-window mechanism reused rather |
| 48 | +// than re-derived. Shown by the BACKEND itself |
| 49 | +// (SettingsService.NotifyPendingApproval's away verdict), never by a |
| 50 | +// hotkey. Deliberately NOT HideOnFocusLost (unlike the Quick Panel): |
| 51 | +// a decision prompt must not vanish just because focus wandered -- |
| 52 | +// Escape (HideOnEscape) is its one explicit, native dismiss path. |
| 53 | +func newApprovalPromptWindow(app *application.App) *application.WebviewWindow { |
| 54 | + return app.Window.NewWithOptions(application.WebviewWindowOptions{ |
| 55 | + Name: "approvalprompt", |
| 56 | + Title: "Mill Approval", |
| 57 | + Width: 520, |
| 58 | + Height: 200, |
| 59 | + Hidden: true, |
| 60 | + Frameless: true, |
| 61 | + DisableResize: true, |
| 62 | + InitialPosition: application.WindowCentered, |
| 63 | + HideOnEscape: true, |
| 64 | + BackgroundColour: application.NewRGB(6, 7, 15), |
| 65 | + Mac: application.MacWindow{ |
| 66 | + Backdrop: application.MacBackdropTranslucent, |
| 67 | + WindowLevel: application.MacWindowLevelFloating, |
| 68 | + CollectionBehavior: application.MacWindowCollectionBehaviorCanJoinAllSpaces | application.MacWindowCollectionBehaviorFullScreenAuxiliary, |
| 69 | + TitleBar: application.MacTitleBar{ |
| 70 | + AppearsTransparent: true, |
| 71 | + Hide: true, |
| 72 | + }, |
| 73 | + }, |
| 74 | + URL: "/#/approvalprompt", |
| 75 | + }) |
| 76 | +} |
0 commit comments