Documentation
¶
Overview ¶
Package gui hosts the desktop app: a tray panel and a regular window that share one small web UI. The UI talks to Go over a tiny JSON API served by the same handler that serves the static assets, so no binding generator or bundler is involved.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OpenPanel bool
OpenPanel has Run open the quick panel once it starts, as `magpie panel` does; a second `magpie panel` toggles it in the running one. Omarchy's bar icon runs it (see omarchy.AddWidget).
var OpenView string
OpenView is the tab the window opens on, as `magpie gui settings` asks: a restart to update comes back where it was asked for.
var Started func()
Started is called once the app has started, by when Wails handles SIGINT and SIGTERM itself (it starts listening as it runs, before the app is said to have started); until then a signal is magpie's to handle.
var Version = "dev"
Version is the build's version string, shown in Settings.
Functions ¶
func Handler ¶
Handler serves the embedded UI and the JSON API. gw is the gateway this process serves, or nil when another magpie has it (for now: see startBackend).
func ImportLink ¶ added in v0.1.8
ImportLink is the link among a launch's arguments, if any.
func LANAddrs ¶ added in v0.1.180
func LANAddrs() []string
LANAddrs are this computer's addresses on the local network, for the links to print when the page is served there: MAGPIE_PUBLIC_URL's host when set (in a container, whose own addresses the network can't reach).
func NetworkLinks ¶ added in v0.1.591
NetworkLinks are the links to the page, served on port, that other machines open; key is the link's "/?k=…". MAGPIE_PUBLIC_URL with a port of its own names the host the container's ports are published on, so the page is at that host on its own port; one without (a reverse proxy's https://magpie.example.com, #372) is where the page is, path and all.
func Run ¶
Run starts the desktop app: a menu bar icon whose click drops down a compact panel, plus a regular window for when you want it to stay around. showMain opens the window immediately; otherwise only the tray icon appears. link is a magpie:// link the app was started with, to confirm and import.
Types ¶
type Glide ¶ added in v0.1.38
Glide is how the panel moves to a new height: over MS milliseconds on a CSS cubic-bezier, so it keeps pace with what the page animates inside it. A zero Glide is a jump.
type Web ¶ added in v0.1.180
type Web struct {
Addr, Link string
// contains filtered or unexported fields
}
Web is a started `magpie web`: its address and the link that signs a browser in.
func StartWeb ¶ added in v0.1.180
StartWeb serves the page on addr (host:port), as the given version of magpie, which keeps itself up to date as the app does. Every request needs the key the link carries, taken once into a cookie other sites' pages can't send with a POST (every change is one), so neither a page elsewhere nor anyone else on the network reaches the settings and keys behind it.
type Windows ¶
type Windows interface {
HidePanel()
// ShowMain brings the window up, on the named tab when view is set.
ShowMain(view string)
Quit()
// OpenURL hands a link to the system browser.
OpenURL(url string)
// OpenFolder shows a folder in the system file manager.
OpenFolder(path string) error
// ChooseFolder asks for a folder in the system's picker: "" when the
// user cancels it.
ChooseFolder(title string) (string, error)
// Copy puts text on the system clipboard, which the page's own
// navigator.clipboard can't always reach from inside the app.
Copy(text string) bool
// FitPanel asks for the panel to be tall enough for its content.
FitPanel(height int, g Glide)
// TintPanel paints the panel's tint behind the page, where the system
// keeps up with the panel's size; false when it can't, for the page to
// go on painting it itself.
TintPanel(rgba [4]uint8, ms int) bool
// TintTitleBar paints the window's title bar the page's colour, where
// the system draws one (Windows); false where there is none to paint.
TintTitleBar(rgba [4]uint8, dark bool) bool
// SetTextSize zooms the window's and the panel's pages to percent
// (settings.TextSizes), the panel's size with them.
SetTextSize(percent int)
}
Windows is what the API needs from the host application.
Source Files
¶
- agent_models.go
- api.go
- app.go
- archive.go
- backend.go
- backup.go
- bus_linux.go
- caller_keys.go
- dev_off.go
- devshell_off.go
- folder_other.go
- glide.go
- glide_other.go
- groups.go
- importapps.go
- importlink.go
- library.go
- lightweight.go
- lightweight_other.go
- lightweight_rule.go
- mainwindow.go
- omarchy.go
- plugins.go
- providers.go
- quota_alert.go
- quota_alert_notify.go
- scheme_linux.go
- sessions.go
- sessions_manage.go
- syslang_other.go
- terminal_apps.go
- terminal_apps_other.go
- textsize.go
- titlebar_gtk4.go
- titletint_other.go
- trace.go
- trayimage_other.go
- traymenu.go
- trayusage.go
- trayusage_tray.go
- update.go
- update_wait.go
- usage.go
- web.go
- whatsnew.go