Documentation
¶
Overview ¶
Package desktop contains the Wails desktop application wrapper for Pando. It renders the Pando web UI inside a native WebView window instead of opening an external browser. The desktop binary is compiled separately and embedded into the main pando binary via go:embed in embed_binary.go.
Index ¶
- Variables
- func Launch(embedBin []byte, pandoURL string, simpleMode bool) error
- func LaunchWindow(embedBin []byte, url string) error
- type App
- func (a *App) GetPandoURL() string
- func (a *App) IsSimpleMode() bool
- func (a *App) OnDomReady(ctx context.Context)
- func (a *App) OpenInBrowser(url string)
- func (a *App) SaveDownload(url, defaultFilename string) (string, error)
- func (a *App) SaveFileDialog(title, defaultFilename string) (string, error)
- func (a *App) SetWindowFocused(focused bool)
- func (a *App) Shutdown(ctx context.Context)
- func (a *App) Startup(ctx context.Context)
- func (a *App) ToggleWindow()
Constants ¶
This section is empty.
Variables ¶
var DesktopBinary []byte
DesktopBinary is the embedded pre-compiled pando-desktop binary for non-macOS builds. Populated by running `make desktop-embed`.
var DesktopBundle embed.FS
Functions ¶
func Launch ¶ added in v0.267.0
Launch starts the desktop wrapper and blocks until the desktop window exits.
Resolution order:
- A pando-desktop wrapper shipped on disk next to the running executable (packaged .app/.pkg installs) — launched in place, preserving its signature & notarization.
- On macOS, an embedded Pando.app bundle extracted to a temp dir.
- The raw embedBin bytes (the compiled pando-desktop produced by `make desktop-embed`) extracted to a temp dir.
embedBin may be nil/empty when the wrapper is shipped on disk instead of embedded.
func LaunchWindow ¶ added in v0.700.0
LaunchWindow starts a desktop wrapper for url and returns immediately.
When LaunchWindow has to extract an embedded wrapper or app bundle, the temp directory is intentionally left behind so the child process keeps its files for its whole lifetime; the OS temp cleanup can reclaim it later.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App holds the Wails desktop application state.
func (*App) GetPandoURL ¶ added in v0.267.0
GetPandoURL returns the configured Pando URL. Exposed as Wails binding.
func (*App) IsSimpleMode ¶ added in v0.267.0
IsSimpleMode returns whether simple mode is active. Exposed as Wails binding.
func (*App) OnDomReady ¶
OnDomReady is called by Wails when the DOM is ready. We navigate the webview to the Pando URL.
func (*App) OpenInBrowser ¶
OpenInBrowser opens a URL in the user's real browser instead of the webview. Design previews and exports are the reason it exists: a preview belongs in a browser with devtools, and a PDF the webview cannot display should not become a blank panel. Exposed as Wails binding.
func (*App) SaveDownload ¶ added in v0.700.0
SaveDownload fetches a URL and writes it to a path the user picks.
It exists because a webview is not a browser: an <a download> or a window.open on a Pando export URL has nowhere to put the file. Doing the fetch on the Go side also keeps the API token out of a second HTTP client. Returns the written path, or "" when the user cancels the dialog. Exposed as Wails binding.
func (*App) SaveFileDialog ¶
SaveFileDialog asks the user where to write a file and returns the chosen path, or "" when they cancel. Exposed as Wails binding.
func (*App) SetWindowFocused ¶ added in v0.267.0
SetWindowFocused is called from JavaScript when the window gains or loses focus. This controls whether OS notifications are shown. Exposed as Wails binding.
func (*App) ToggleWindow ¶ added in v0.267.0
func (a *App) ToggleWindow()
ToggleWindow shows the window if hidden, hides it if visible. Exposed as Wails binding.