Documentation
¶
Overview ¶
Package giode is a UI library built on Gio that brings the ease of retained-mode APIs to immediate mode: interfaces are described with simple composable functions, styled with CSS-like properties and wired up with plain Go callbacks, while raw Gio remains fully available for low-level customization.
The package re-exports the public API of its subpackages (styles/properties, elements, components, router) for single-import ergonomics; the subpackages remain importable directly.
The re-exports live in package ui, which a custom host (a GLFW window, see docs/low-level.md) imports instead to get the same names without App and Gio's window layer; reexport.go is generated from it.
Index ¶
- Constants
- Variables
- func ContextActionCLSID(prefix, id string) string
- func EncodeWAV(samples []float32, sampleRate int) []byte
- func Haptic(k HapticKind)
- func IsElevated() bool
- func Keyed[T any](scope, key any, init func() T) T
- func LaunchedAtLogin() bool
- func SafeArea() properties.Inset
- func SystemDarkMode() (bool, error)
- func TraySupported() bool
- type Align
- type App
- func (a *App) AlwaysOnTop() bool
- func (a *App) Center()
- func (a *App) Close()
- func (a *App) CloseToTray() bool
- func (a *App) ContextActions() []ContextAction
- func (a *App) Dictate(ctx context.Context, lang string) (<-chan Transcript, error)
- func (a *App) FileDrag() (d FileDrag, ok bool)
- func (a *App) Focused() bool
- func (a *App) Frame() (Rect, error)
- func (a *App) FrameStats() FrameStats
- func (a *App) Fullscreen() bool
- func (a *App) Haptic(k HapticKind)
- func (a *App) HideKeyboard()
- func (a *App) HideWindow()
- func (a *App) InstallContextActions() error
- func (a *App) Invalidate()
- func (a *App) KeepAlive(reason string) (release func(), err error)
- func (a *App) KeepScreenOn(on bool) error
- func (a *App) LaunchAtLogin() bool
- func (a *App) MCPAddress() string
- func (a *App) MCPServer() *mcp.Server
- func (a *App) MCPTool(t mcp.Tool)
- func (a *App) MaxFPS() int
- func (a *App) Maximize()
- func (a *App) Maximized() bool
- func (a *App) Minimize()
- func (a *App) MinimizeToTray() bool
- func (a *App) MoveTo(c Corner, margin float32) error
- func (a *App) NativeHandle() uintptr
- func (a *App) NativeView() app.ViewEvent
- func (a *App) Notify(title, body string) error
- func (a *App) OpenDownloads(ctx context.Context, folder string) error
- func (a *App) OpenFile(ctx context.Context, filter ...FileFilter) (io.ReadCloser, error)
- func (a *App) OpenFiles(ctx context.Context, filter ...FileFilter) ([]io.ReadCloser, error)
- func (a *App) OpenFolder(ctx context.Context, path string) error
- func (a *App) OpenURL(ctx context.Context, rawURL string) error
- func (a *App) PickFiles(ctx context.Context, opts PickOptions) ([]PickedFile, error)
- func (a *App) PickFolder(ctx context.Context, opts FolderOptions) (string, error)
- func (a *App) PickPhoto(ctx context.Context, opts PhotoOptions) (PickedFile, error)
- func (a *App) PickPhotos(ctx context.Context, opts PhotoOptions, limit int) ([]PickedFile, error)
- func (a *App) PlaySound(wav []byte) error
- func (a *App) Post(fn func())
- func (a *App) Quit()
- func (a *App) Raise()
- func (a *App) ReadClipboard(fn func(text string))
- func (a *App) ReadClipboardImage(ctx context.Context) (image.Image, error)
- func (a *App) RequestClose()
- func (a *App) ResetFrameStats()
- func (a *App) RestartElevated(args ...string) error
- func (a *App) Run(view func() Element) error
- func (a *App) RunOnUI(ctx context.Context, fn func()) error
- func (a *App) RunRaw(view func(gtx layout.Context) layout.Dimensions) error
- func (a *App) SaveFile(ctx context.Context, name string) (io.WriteCloser, error)
- func (a *App) SaveToDownloads(ctx context.Context, path, folder string) (string, error)
- func (a *App) SaveToPhotos(ctx context.Context, path, album string) error
- func (a *App) Screen() (Screen, error)
- func (a *App) SetAlwaysOnTop(on bool)
- func (a *App) SetClipboard(text string)
- func (a *App) SetCloseToTray(on bool)
- func (a *App) SetContextMenu(m *menu.Menu)
- func (a *App) SetFullscreen(v bool)
- func (a *App) SetLaunchAtLogin(on bool) error
- func (a *App) SetMaxFPS(fps int)
- func (a *App) SetMinimizeToTray(on bool)
- func (a *App) SetPosition(x, y float32) error
- func (a *App) SetSize(w, h int)
- func (a *App) SetTitle(title string)
- func (a *App) Share(ctx context.Context, item Shareable) error
- func (a *App) ShowWindow()
- func (a *App) Title() string
- func (a *App) ToggleMaximize()
- func (a *App) Tray() *Tray
- func (a *App) UninstallContextActions() error
- func (a *App) Unmaximize()
- func (a *App) Window() *app.Window
- func (a *App) WindowState() WindowState
- func (a *App) WindowVisible() bool
- type AppShellConfig
- type AppShellSlot
- type BackgroundFit
- type BackgroundImage
- type BoxElement
- type BoxShadow
- type Breakpoint
- type ButtonElement
- type ButtonVariant
- type CanvasPath
- type ClickEvent
- type ClickSource
- type Color
- type ColorStop
- type Config
- type Constraints
- type Context
- type ContextAction
- type ContextMenu
- type Contextual
- type Corner
- type Corners
- type Cursor
- type Detent
- type DeviceClass
- type DeviceInfo
- type Dimensions
- type Display
- type DividerElement
- type DragEvent
- type Easing
- type Element
- type FileDrag
- type FileDragKind
- type FileFilter
- type Fit
- type FlexDirection
- type FolderOptions
- type FontFile
- type FontStyle
- type FontWeight
- type FrameStats
- type FrameTiming
- type GPUAPI
- type GPUTarget
- type HapticKind
- type IconButtonVariant
- type IconDocument
- type IconPath
- type IconRegistry
- type IconSource
- type InputAPI
- type Inset
- type IntlOptions
- type Justify
- type KeyShortcut
- type Keyboard
- type KeyedCache
- type LazyAlign
- type LazyAnchor
- type LazyListElement
- type LinearGradient
- type LogLevel
- type Logger
- type MCPOptions
- type MarkdownOptions
- type MaxLines
- type MemoCache
- type Mode
- type MouseButton
- type NamedKey
- type Orientation
- type OutOfFlow
- type Overflow
- type Painter
- type Palette
- type PhotoOptions
- type PhotoSource
- type PickOptions
- type PickedFile
- type Placement
- type Position
- type PressState
- type PressableElement
- type RawFunc
- type Rect
- type Renderer
- type RichTextElement
- type RichTextSpan
- type Route
- type Router
- type Screen
- type ScrollAlign
- type ScrollAnchor
- type ScrollAxis
- type ScrollBar
- type SecureStorage
- type SemanticKind
- type SemanticNode
- type ShareFile
- type ShareFiles
- type ShareText
- type Shareable
- type SharedContent
- type SheetMode
- type Side
- type SingleInstanceLock
- type StartInTray
- type State
- type StyleTransition
- type Styles
- type SubmitMode
- type SwipeAction
- type Tab
- type TabWidth
- type TextAlign
- type TextDecoration
- type TextElement
- type TextOverflow
- type TextTransform
- type TitleBarButton
- type TitleBarVariant
- type TitleBarWindow
- type ToastKind
- type ToastPlacement
- type ToasterElement
- type Transcript
- type Transform
- type TransitionElement
- type TransitionKind
- type Tray
- type TrayItem
- type TreeNode
- type TreeRowState
- type TreeViewElement
- type VirtualListElement
- type Visibility
- type Watch
- type WindowStartState
- type WindowState
- type Wrap
Constants ¶
const ( VariantContained = ui.VariantContained VariantOutlined = ui.VariantOutlined VariantGhost = ui.VariantGhost IconButtonContained = ui.IconButtonContained IconButtonOutlined = ui.IconButtonOutlined IconButtonGhost = ui.IconButtonGhost )
const ( SheetNever = ui.SheetNever SheetCompact = ui.SheetCompact SheetAlways = ui.SheetAlways )
const ( Vertical = ui.Vertical Horizontal = ui.Horizontal AnchorTop = ui.AnchorTop AnchorBottom = ui.AnchorBottom )
const ( SubmitDefault = ui.SubmitDefault SubmitEnter = ui.SubmitEnter SubmitEnterUnlessShift = ui.SubmitEnterUnlessShift SubmitNever = ui.SubmitNever )
const ( DetentFit = ui.DetentFit DetentMedium = ui.DetentMedium DetentLarge = ui.DetentLarge )
const ( KeyboardText = ui.KeyboardText KeyboardNumeric = ui.KeyboardNumeric KeyboardEmail = ui.KeyboardEmail KeyboardURL = ui.KeyboardURL KeyboardPhone = ui.KeyboardPhone )
const ( SideLeft = ui.SideLeft SideRight = ui.SideRight // SideStart and SideEnd follow the reading direction: left and // right, swapped in a right-to-left locale. SideStart = ui.SideStart SideEnd = ui.SideEnd )
const ( ModeLight = ui.ModeLight ModeDark = ui.ModeDark )
const ( TitleBarWindows = ui.TitleBarWindows TitleBarMac = ui.TitleBarMac TitleBarMinimize = ui.TitleBarMinimize TitleBarMaximize = ui.TitleBarMaximize TitleBarClose = ui.TitleBarClose )
const ( ToastInfo = ui.ToastInfo ToastSuccess = ui.ToastSuccess ToastWarning = ui.ToastWarning ToastError = ui.ToastError ToastBottomRight = ui.ToastBottomRight ToastBottomLeft = ui.ToastBottomLeft ToastBottomCenter = ui.ToastBottomCenter ToastTopRight = ui.ToastTopRight ToastTopLeft = ui.ToastTopLeft ToastTopCenter = ui.ToastTopCenter // ToastBottomEnd (the default), ToastBottomStart, ToastTopEnd and // ToastTopStart follow the reading direction. ToastBottomEnd = ui.ToastBottomEnd ToastBottomStart = ui.ToastBottomStart ToastTopEnd = ui.ToastTopEnd ToastTopStart = ui.ToastTopStart )
const ( // PlaceAuto puts it below the trigger, or above when it doesn't fit. PlaceAuto = ui.PlaceAuto PlaceBelow = ui.PlaceBelow PlaceAbove = ui.PlaceAbove )
const ( ScrollAlignNearest = ui.ScrollAlignNearest ScrollAlignStart = ui.ScrollAlignStart ScrollAlignCenter = ui.ScrollAlignCenter ScrollAlignEnd = ui.ScrollAlignEnd )
const ( LazyAnchorTop = ui.LazyAnchorTop LazyAnchorBottom = ui.LazyAnchorBottom LazyAlignStart = ui.LazyAlignStart LazyAlignCenter = ui.LazyAlignCenter LazyAlignEnd = ui.LazyAlignEnd )
const ( Fade = ui.Fade SlideUp = ui.SlideUp SlideDown = ui.SlideDown SlideLeft = ui.SlideLeft SlideRight = ui.SlideRight Enlarge = ui.Enlarge Shrink = ui.Shrink Rotate = ui.Rotate Collapse = ui.Collapse CollapseWidth = ui.CollapseWidth FadeUp = ui.FadeUp Zoom = ui.Zoom Pop = ui.Pop TransitionFast = ui.TransitionFast TransitionNormal = ui.TransitionNormal TransitionSlow = ui.TransitionSlow )
const ( FlexDirectionRow = ui.FlexDirectionRow FlexDirectionColumn = ui.FlexDirectionColumn WrapNoWrap = ui.WrapNoWrap WrapWrap = ui.WrapWrap AlignStart = ui.AlignStart AlignCenter = ui.AlignCenter AlignEnd = ui.AlignEnd AlignStretch = ui.AlignStretch JustifyStart = ui.JustifyStart JustifyCenter = ui.JustifyCenter JustifyEnd = ui.JustifyEnd JustifySpaceBetween = ui.JustifySpaceBetween JustifySpaceAround = ui.JustifySpaceAround JustifySpaceEvenly = ui.JustifySpaceEvenly TextAlignStart = ui.TextAlignStart TextAlignCenter = ui.TextAlignCenter TextAlignEnd = ui.TextAlignEnd FontWeightThin = ui.FontWeightThin FontWeightExtraLight = ui.FontWeightExtraLight FontWeightLight = ui.FontWeightLight FontWeightNormal = ui.FontWeightNormal FontWeightMedium = ui.FontWeightMedium FontWeightSemiBold = ui.FontWeightSemiBold FontWeightBold = ui.FontWeightBold FontWeightExtraBold = ui.FontWeightExtraBold FontWeightBlack = ui.FontWeightBlack FontStyleNormal = ui.FontStyleNormal FontStyleItalic = ui.FontStyleItalic CursorDefault = ui.CursorDefault CursorNone = ui.CursorNone CursorText = ui.CursorText CursorPointer = ui.CursorPointer CursorCrosshair = ui.CursorCrosshair CursorGrab = ui.CursorGrab CursorGrabbing = ui.CursorGrabbing CursorNotAllowed = ui.CursorNotAllowed CursorWait = ui.CursorWait FitNone = ui.FitNone FitContain = ui.FitContain FitCover = ui.FitCover FitStretch = ui.FitStretch PositionStatic = ui.PositionStatic PositionRelative = ui.PositionRelative PositionAbsolute = ui.PositionAbsolute // Flush is an explicit zero offset for Top, Right, Bottom and Left, // whose zero value means unset: Bottom: giode.Flush pins a box to // the bottom edge. Flush = ui.Flush TextDecorationNone = ui.TextDecorationNone TextDecorationUnderline = ui.TextDecorationUnderline TextDecorationLineThrough = ui.TextDecorationLineThrough OverflowVisible = ui.OverflowVisible OverflowHidden = ui.OverflowHidden DisplayNone = ui.DisplayNone VisibilityVisible = ui.VisibilityVisible VisibilityHidden = ui.VisibilityHidden TextTransformNone = ui.TextTransformNone TextTransformUppercase = ui.TextTransformUppercase TextTransformLowercase = ui.TextTransformLowercase TextTransformCapitalize = ui.TextTransformCapitalize TextOverflowClip = ui.TextOverflowClip TextOverflowEllipsis = ui.TextOverflowEllipsis MousePrimary = ui.MousePrimary MouseSecondary = ui.MouseSecondary MouseMiddle = ui.MouseMiddle ClickPointer = ui.ClickPointer ClickKeyboard = ui.ClickKeyboard ClickProgrammatic = ui.ClickProgrammatic EaseInOut = ui.EaseInOut Ease = ui.Ease EaseLinear = ui.EaseLinear EaseIn = ui.EaseIn EaseOut = ui.EaseOut EaseOutBack = ui.EaseOutBack EaseInBack = ui.EaseInBack EaseOutBounce = ui.EaseOutBounce )
const OverlayMargin = ui.OverlayMargin
OverlayMargin is the default distance kept between an overlay and the window edges.
Variables ¶
var ( // ForgetKeyed drops a Keyed entry right away. ForgetKeyed = ui.ForgetKeyed // SetKeyedRetention sets how many frames Keyed entries survive // without being asked for. SetKeyedRetention = ui.SetKeyedRetention )
var ( Box = ui.Box Row = ui.Row Stack = ui.Stack Text = ui.Text Raw = ui.Raw // Intl returns the translation of key in the app's locale with data // filled into its {placeholders}: a map, a struct or name, value // pairs; a "count" picks plural forms. Turn translations on with // Config.Intl. See i18n.Intl. Intl = ui.Intl // SetLocale switches the app's locale ("fa", "pt-BR"); the UI // redraws in it. SetLocale = ui.SetLocale // Locale returns the app's locale. Locale = ui.Locale // Locales lists the locales with messages loaded. Locales = ui.Locales // Canvas is an element drawn with a Painter: shapes, arcs, rings, // sectors and paths in dp; see elements.Canvas. Canvas = ui.Canvas Divider = ui.Divider // RichText lays out differently styled spans as one wrapping // paragraph; see elements.RichText. RichText = ui.RichText // Span is a run of text in a RichText; Link a tappable one. Span = ui.Span Link = ui.Link // Markdown renders Markdown as giode elements; see markdown.New. Markdown = ui.Markdown Responsive = ui.Responsive // ActiveBreakpoint returns the name of the breakpoint the innermost // enclosing Responsive matched. ActiveBreakpoint = ui.ActiveBreakpoint // Compact reports whether the innermost enclosing Responsive matched // a breakpoint named "compact". Compact = ui.Compact // HandleBack registers a handler for the system Back button for the // current frame; see elements.HandleBack. HandleBack = ui.HandleBack // OnKey registers, for this frame, a handler for the keys nothing // else took (app shortcuts); see elements.OnKey. OnKey = ui.OnKey // NoInset is an explicit zero Padding or Margin: an all-zero Inset // means unset (Merge keeps the base's, components use their default). NoInset = ui.NoInset // Shortcut returns a keyboard shortcut ("Mod+T", "Ctrl+Shift+P", // "F5") running action; Mod is Command on macOS, Ctrl elsewhere. // Register shortcuts with Shortcuts. See package shortcut. Shortcut = ui.Shortcut // FormatShortcut writes a shortcut spec the way this platform // shows it: "⇧⌘T" on macOS, "Ctrl+Shift+T" elsewhere. FormatShortcut = ui.FormatShortcut // TouchInput reports whether the user is interacting by touch. TouchInput = ui.TouchInput // Pressable makes any content clickable; its content is rebuilt // with the current PressState so it can restyle itself. Pressable = ui.Pressable // Memo caches the output of build under key, rebuilding only when // its deps, the States it reads, its constraints or the theme // change - see elements.MemoCache for the full rules. Memo = ui.Memo // SelectionArea makes the Text, RichText and Markdown inside its // child selectable as one, across elements, like a web page. SelectionArea = ui.SelectionArea // NewMemoCache returns a cache to hold in a stateful component. NewMemoCache = ui.NewMemoCache // InvalidateCaches forces every Memo to rebuild on the next frame. InvalidateCaches = ui.InvalidateCaches // AfterLayout runs a function once the current frame's layout is // done, on the UI goroutine - for handlers that change the model // the frame is still reading. AfterLayout = ui.AfterLayout // DisplayScale returns the display's pixels per dp as of the last // frame; DpToPx and PxToDp convert with it. Safe from anywhere. DisplayScale = ui.DisplayScale DpToPx = ui.DpToPx PxToDp = ui.PxToDp Table = ui.Table TableHeader = ui.TableHeader TableRow = ui.TableRow TableCell = ui.TableCell )
var ( Button = ui.Button // CopyButton copies text to the clipboard when clicked and briefly // shows a check mark. CopyButton = ui.CopyButton IconButton = ui.IconButton Tabs = ui.Tabs Scroll = ui.Scroll // Swipeable makes a row reveal actions when swiped sideways; see // swipeable.New. Swipeable = ui.Swipeable // Zoomable pinch-zooms and pans its content - a page, a photo, a // crop editor - with a double tap and Ctrl+wheel too; see zoom.New. Zoomable = ui.Zoomable // Sheet is a modal bottom sheet, or with Adaptive a centered // dialog on wide screens; see sheet.New. Sheet = ui.Sheet // Chip is a small rounded label for filters and tags; Badge a // counter or dot; Avatar a picture or initials in a circle. Chip = ui.Chip Badge = ui.Badge Avatar = ui.Avatar Drawer = ui.Drawer Dialog = ui.Dialog Menu = ui.Menu Progress = ui.Progress Spinner = ui.Spinner Image = ui.Image Tooltip = ui.Tooltip Accordion = ui.Accordion Pagination = ui.Pagination H1 = ui.H1 H2 = ui.H2 H3 = ui.H3 H4 = ui.H4 H5 = ui.H5 H6 = ui.H6 )
var ( // IconSVG renders raw SVG path data on a 24x24 viewBox. IconSVG = ui.IconSVG // IconSVGCustom renders raw SVG path data on a custom viewBox. IconSVGCustom = ui.IconSVGCustom // IconSVGStroke strokes raw SVG path data (outline icon sets). IconSVGStroke = ui.IconSVGStroke IconImage = ui.IconImage IconIconVG = ui.IconIconVG LoadIconVG = ui.LoadIconVG // LoadIconSVG parses a whole .svg file's bytes; call .Icon(st...) // on the result to render it. LoadIconSVG = ui.LoadIconSVG // MustLoadIconSVG is LoadIconSVG, panicking on error - convenient // for bytes known at compile time, e.g. via go:embed. MustLoadIconSVG = ui.MustLoadIconSVG // LoadIconSVGFile and LoadIconSVGFS read and parse an .svg file // from disk or from an fs.FS (such as an embed.FS). LoadIconSVGFile = ui.LoadIconSVGFile LoadIconSVGFS = ui.LoadIconSVGFS // RegisterIcon, RegisterIconSVG, RegisterIconsFS and // RegisterIconsDir add icons to the default registry; Icon renders // one by name. RegisterIcon = ui.RegisterIcon RegisterIconSVG = ui.RegisterIconSVG RegisterIconsFS = ui.RegisterIconsFS RegisterIconsDir = ui.RegisterIconsDir LookupIcon = ui.LookupIcon IconNames = ui.IconNames // Icon renders a registered icon; an unknown name renders as empty // space of the icon's size. Icon = ui.Icon )
Giode bundles no icon set: load the icons your app uses from SVG files (or path data, IconVG, images) and, optionally, register them by name.
var ( UseGofont = ui.UseGofont RegisterFonts = ui.RegisterFonts // RegisterFont adds TTF, OTF or TTC font files by family, weight // and style; see fonts.RegisterFont. RegisterFont = ui.RegisterFont )
var ( HexColor = ui.HexColor // Mix blends two colors in sRGB space, like CSS; see properties.Mix. Mix = ui.Mix // ParseColor validates any CSS color (hex, rgb(), hsl(), named). ParseColor = ui.ParseColor // Linear builds a linear gradient for Styles.BackgroundGradient. Linear = ui.Linear UniformCorners = ui.UniformCorners TopCorners = ui.TopCorners BottomCorners = ui.BottomCorners UniformInset = ui.UniformInset SymmetricInset = ui.SymmetricInset )
var ( // SetMode switches the active color mode, changing what every // "theme.*" color token (e.g. Styles{Background: "theme.surface"}) // resolves to on the next frame. SetMode = ui.SetMode // CurrentMode returns the active color mode (ModeLight by // default). CurrentMode = ui.CurrentMode // SetPalette replaces the palette used for mode m, changing what // every "theme.*" color token resolves to while that mode is // active. Start from DefaultLightPalette/DefaultDarkPalette to // override just a few fields. SetPalette = ui.SetPalette // ToggleMode switches between light and dark mode. ToggleMode = ui.ToggleMode // CurrentPalette returns the palette of the active mode. CurrentPalette = ui.CurrentPalette )
var ( DefaultLightPalette = ui.DefaultLightPalette DefaultDarkPalette = ui.DefaultDarkPalette )
DefaultLightPalette and DefaultDarkPalette are the built-in palettes for ModeLight/ModeDark, in effect until SetPalette overrides one of them.
var ( // AppShell returns a full-window layout: Header/Navbar/Aside/Footer // (each optional, via AppShellConfig) are fixed to their respective // edges, and Main fills the remaining space, offset by whichever of // them are present. AppShell = ui.AppShell // Header, Navbar, Aside and Footer build an AppShellConfig field - // AppShellConfig{Header: giode.Header(60, ...), ...}. Header = ui.Header Aside = ui.Aside // Main wraps an AppShell's main content area. Main = ui.Main // Section groups content inside a Navbar/Aside as a scrollable // area. Section = ui.Section )
var ( Scale = ui.Scale Hovered = ui.Hovered Pressed = ui.Pressed Alpha = ui.Alpha ClampPos = ui.ClampPos )
var ( AppVersion string AppBuild string )
AppVersion and AppBuild are the app's version and build number from giode.toml (app.version, app.build): the giode CLI sets them when it builds or runs a desktop app (with -ldflags -X). They're empty in a plain go build.
var AppID string
AppID is the app's reverse-DNS ID from giode.toml (app.id): the giode CLI sets it when it builds a desktop app (with -ldflags -X), as it does AppVersion. Login registration names its entry after it; without it, after the window title.
var AppName string
AppName is the app's name from giode.toml (app.name), which the giode CLI builds in (as buildAppName, base64 encoded since names have spaces). The start-at-login entry shows it; without it, the window title is used.
var ErrCanceled = errors.New("giode: canceled by the user")
ErrCanceled is returned by OpenFile, OpenFiles and SaveFile when the user closes the dialog without choosing a file.
var ErrDeclined = errors.New("giode: the user declined")
ErrDeclined is returned by RestartElevated when the user refuses the administrator prompt.
var ErrNotFound = errors.New("giode: not found")
ErrNotFound is returned by SecureStore.Get for a name with no value.
var ErrNotSupported = host.ErrNotSupported
ErrNotSupported is returned by features the current platform lacks.
var Frame = ui.Frame
Frame lays out one frame of view into gtx the way App does, for a custom host (a GLFW window, an embedded view): it starts the frame, records the window size and metric, lays the view out, draws the portals (menus, tooltips, toasts), delivers the Back key and then the keys nothing took to OnKey handlers, runs the after-layout callbacks and ends the frame, sweeping keyed state and memos no longer used. gtx's constraints are the window's size.
It reports whether another frame is needed right away (a layout changed after the fact); the host should then redraw. Animations ask for frames through gtx as usual (op.InvalidateCmd, the router's wakeup time), and State changes and toasts shown from other goroutines through the function given to SetInvalidator.
The host fills the background, hands gtx.Ops to its GPU renderer and runs its input router, as in docs/low-level.md.
var Input = ui.Input
Input groups the form-control constructors that collect user input: Input.Text, Input.Checkbox, Input.Slider, Input.Select and Input.AutoComplete.
var LazyList = ui.LazyList
LazyList is a vertical list of rows of any height, identified by keys, that only builds the rows in or near the viewport. It keeps its place when rows above change, and can stick to the end like a chat:
list := giode.LazyList(
func() int { return len(msgs) },
func(i int) any { return msgs[i].ID },
func(i int) giode.Element { return messageRow(msgs[i]) },
).Anchor(giode.LazyAnchorBottom)
var LicensesView = ui.LicensesView
LicensesView lists the open-source licenses of the app's modules, from the JSON giode licenses writes; a row per module expands to its text.
var NewRouter = ui.NewRouter
var SecureStore = &SecureStorage{}
SecureStore is the app's secure storage; see SecureStorage.
var SetInvalidator = ui.SetInvalidator
SetInvalidator registers fn, which wakes the host's loop for a new frame. It's called from any goroutine: when a State changes, a toast is shown from a background goroutine, or anything else outside a frame needs a redraw. App sets its own; a custom host sets one that wakes its event loop (glfw.PostEmptyEvent, a channel).
var Shortcuts = ui.Shortcuts
Shortcuts registers app-wide keyboard shortcuts for this frame: call it from the view every frame. They fire whatever has focus, unless the focused field (or anything else in the UI) takes the key first; see OnKey.
giode.Shortcuts(
giode.Shortcut("Mod+T", newTab),
giode.Shortcut("Mod+,", openSettings),
giode.Shortcut("F5", refresh),
)
var TitleBar = ui.TitleBar
TitleBar returns a custom window title bar for a frameless window: a drag handle with the title, optional icon and menus, and minimize/maximize/close buttons. Pass the *App:
app := giode.New(giode.Config{Frameless: true, Resizable: true})
bar := giode.TitleBar(app, "My app")
var Toaster = ui.Toaster
Toaster shows small notifications in a corner of the window that disappear on their own. Lay it out once per frame anywhere; call Show from any goroutine.
var Transition = ui.Transition
Transition animates a component in and out. It takes the component, the effect (combine kinds with |), the duration and a CSS-style easing:
panel := giode.Transition(content, giode.FadeUp, giode.TransitionNormal, giode.EaseOut)
giode.Button("Toggle").OnClick(panel.Toggle)
var TreeView = ui.TreeView
TreeView is a virtualized, keyboard-navigable tree. It owns expansion and selection by key and draws indentation, arrows and selection; the row function draws only each node's content.
var VirtualList = ui.VirtualList
VirtualList is a vertical list of equal-height rows (height in dp) that only builds the rows in or near the viewport:
list := giode.VirtualList(func() int { return len(rows) }, 32,
func(i int) giode.Element { return rowView(rows[i]) })
Functions ¶
func ContextActionCLSID ¶
ContextActionCLSID returns the COM class ID Explorer's DropTarget verb for a context action names, as "{XXXXXXXX-XXXX-...}": a name-based UUID (version 5) of "giode-context-action:" + prefix + "." + id.
func EncodeWAV ¶
EncodeWAV returns a mono 16-bit WAV of samples, each from -1 to 1, at sampleRate per second - for PlaySound, with tones generated in code:
const rate = 44100
samples := make([]float32, rate/5) // 0.2 s
for i := range samples {
t := float64(i) / rate
fade := 1 - float64(i)/float64(len(samples))
samples[i] = float32(0.2 * fade * math.Sin(2*math.Pi*440*t))
}
app.PlaySound(giode.EncodeWAV(samples, rate))
func Haptic ¶
func Haptic(k HapticKind)
Haptic plays haptic feedback through the most recently created App; see App.Haptic.
func IsElevated ¶
func IsElevated() bool
IsElevated reports whether the app runs with administrator rights: elevated by UAC on Windows, as root on Linux and macOS.
func Keyed ¶
Keyed returns the state stored under (scope, key), creating it with init the first time - persistent per-item state (a Pressable, a text field) for lists that change at runtime. Entries not asked for in a while are dropped, so removed items don't leak. Use stable keys (IDs), not indexes.
func LaunchedAtLogin ¶
func LaunchedAtLogin() bool
LaunchedAtLogin reports whether the system started the app when the user signed in, from a registration made with App.SetLaunchAtLogin - to start quietly, in the tray (see Config.StartInTray), rather than as if the user had opened it.
func SafeArea ¶
func SafeArea() properties.Inset
SafeArea returns the parts of the window covered by system UI - the status bar, the navigation bar or home indicator, a notch or camera cutout, and on iOS the on-screen keyboard - as insets in dp, as of the last frame. Read it during layout.
By default giode lays the view out inside the safe area, so content never sits under system UI and this is only informative. With Config.EdgeToEdge the view covers the whole window and SafeArea is what to pad content with: a header's top, a composer's bottom.
On Android the window shrinks to make room for the on-screen keyboard, so content laid out above the bottom edge stays above the keyboard either way.
func SystemDarkMode ¶
SystemDarkMode reports whether the platform is set to a dark appearance: on Android, iOS, macOS, Windows, the web, and Linux desktops that implement the XDG appearance setting (GNOME, KDE). Elsewhere it returns ErrNotSupported.
func TraySupported ¶
func TraySupported() bool
TraySupported reports whether this platform has a system tray giode can use: Windows, macOS and Linux.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App owns a window and its render loop.
func New ¶
New creates an App from cfg. The window is created and shown the first time the app runs.
func (*App) AlwaysOnTop ¶
AlwaysOnTop reports whether the window was set to stay above other windows, by Config.AlwaysOnTop or SetAlwaysOnTop.
func (*App) Close ¶
func (a *App) Close()
Close requests the window to close, ending the app - also with CloseToTray, which only applies to the user closing it.
It may be called from any goroutine: the close itself runs on the UI goroutine (Gio's Perform isn't safe elsewhere), which Post reaches even while the window is hidden.
func (*App) CloseToTray ¶
CloseToTray reports whether closing the window hides it to the tray.
func (*App) ContextActions ¶
func (a *App) ContextActions() []ContextAction
ContextActions returns the app's context actions: giode.toml's (through the giode CLI) and Config.ContextActions, which win by ID.
func (*App) Dictate ¶
Dictate listens through the microphone and transcribes speech, for a microphone button in a composer. Results arrive on the channel as the user speaks - each holds the whole transcript so far - and the channel closes after the Final one, which comes when the user stops speaking. Cancelling ctx stops listening early; a final result still follows.
It uses the platform's speech recognizer, asking for permission the first time: Android's SpeechRecognizer (the app must import gioui.org/app/permission/microphone so the permission is in its manifest), and SFSpeechRecognizer on iOS (the app's Info.plist needs NSMicrophoneUsageDescription and NSSpeechRecognitionUsageDescription, or it returns an error wrapping ErrNotSupported; see docs/platform.md). Elsewhere it returns ErrNotSupported. lang is a BCP 47 tag ("en-US"), or "" for the device's language.
func (*App) FileDrag ¶
FileDrag returns the drag of files over the window in progress, if any, as of the last FileDrag event: in a view, a drop zone can draw itself highlighted while ok is true. The window redraws when it changes. It needs OnFileDrop or OnFileDrag set.
func (*App) Frame ¶
Frame returns the window's area on the desktop in dp, its title bar and borders included. See Screen for where it's supported.
func (*App) FrameStats ¶
func (a *App) FrameStats() FrameStats
FrameStats returns how long the last frames (up to 240) took to build and to render, and the frame rate while frames followed each other. The built-in MCP server reports it as the frame_stats tool; Config.ShowFrameTimes shows it on screen. Safe to call from any goroutine.
func (*App) Fullscreen ¶
Fullscreen reports whether the window is fullscreen.
func (*App) Haptic ¶
func (a *App) Haptic(k HapticKind)
Haptic plays haptic feedback on the device: through the view's haptic feedback on Android (which follows the user's touch feedback setting) and the feedback generators on iOS. It returns at once and does nothing on platforms without haptics.
func (*App) HideKeyboard ¶
func (a *App) HideKeyboard()
HideKeyboard hides the on-screen keyboard and takes keyboard focus from the focused field, on the next frame. Safe to call from any goroutine.
func (*App) HideWindow ¶
func (a *App) HideWindow()
HideWindow hides the window without closing it: it leaves the screen and the taskbar or Dock, and ShowWindow brings it back as it was. With a tray icon it's how an app keeps running in the background. On Linux it works under X11; Wayland can't hide windows (nor bring a minimized one back), so there it does nothing, as on Android, iOS and the web. It may be called from any goroutine, as may ShowWindow and Quit.
func (*App) InstallContextActions ¶
InstallContextActions adds the app's context actions to the file manager's menu for the current user, pointing at the running executable; no administrator rights needed. Call it on first run (or from a setting) when the app isn't installed by its setup program. It replaces actions installed before, so it's safe to call on every start. On macOS the actions come from the app bundle instead, and it does nothing.
func (*App) Invalidate ¶
func (a *App) Invalidate()
Invalidate asks for a new frame. It's safe to call from any goroutine: an underlay's new video frame is ready, say.
func (*App) KeepAlive ¶
KeepAlive asks the system to keep the app running work it started - an agent run, a long download - until release is called:
- Desktops: the computer doesn't go to sleep while idle.
- iOS: the app gets the short grace period iOS allows after it leaves the screen (about 30 seconds), via beginBackgroundTask.
- Android: a foreground service keeps the app running after it leaves the screen, with an ongoing notification showing reason. Call it while the app is shown. The app's manifest must declare the service (see docs/platform.md), which gogio can't do yet; without it KeepAlive returns an error wrapping ErrNotSupported, so the app can tell the user to keep it open (with KeepScreenOn) or save its progress in OnBackground.
reason is shown where the platform shows one (Android's notification, Linux's inhibitor list, macOS's power assertions).
func (*App) KeepScreenOn ¶
KeepScreenOn keeps the screen from dimming and locking while on is set and the app is shown - for on-device generation the user is watching. On desktops it holds off the screen saver and display sleep.
func (*App) LaunchAtLogin ¶
LaunchAtLogin reports whether the app is registered to start when the user signs in (and, on Windows, the user hasn't turned it off).
func (*App) MCPAddress ¶
MCPAddress returns the address the MCP server listens on ("127.0.0.1:7600"), once it does; "" before that, without Config.MCP, or on stdio. With port 0 it's the port the system picked.
func (*App) MCPServer ¶
MCPServer returns the app's MCP server for full control, or nil when Config.MCP is off.
func (*App) MCPTool ¶
MCPTool registers a custom tool with the app's MCP server. Use mcp.Func to build one from a typed Go function:
app.MCPTool(mcp.Func("add_todo", "Adds a todo item.",
func(ctx context.Context, in struct {
Title string `json:"title" description:"The todo's title"`
}) (any, error) {
todos.Update(func(t []string) []string { return append(t, in.Title) })
return "added", nil
}))
Handlers run on server goroutines: touch the UI through State (which is safe from any goroutine) or App.RunOnUI. It's a no-op unless Config.MCP is set.
func (*App) MinimizeToTray ¶
MinimizeToTray reports whether minimizing the window hides it to the tray.
func (*App) MoveTo ¶
MoveTo moves the window to a corner of its screen's work area (or its center), margin dp from the edges - a mini player in the bottom right, say. Where it's supported is as for SetPosition.
func (*App) NativeHandle ¶
NativeHandle returns the native window handle: the HWND on Windows, the NSView on macOS, the X11 window ID or the wl_surface pointer on Linux, the android.view.View reference on Android. It is 0 until the window exists.
func (*App) NativeView ¶
NativeView returns the platform view event Gio reported for the window: an app.Win32ViewEvent on Windows, app.AppKitViewEvent on macOS, app.X11ViewEvent or app.WaylandViewEvent on Linux, ... It is nil until the window exists. Use it for platform integrations Giode doesn't cover.
func (*App) Notify ¶
Notify shows a system notification with title and body - to tell the user a run or a download finished while the app was in the background. It works on Android, macOS, Windows and Linux (through gioui.org/x/notify). On Android 13 and later the system asks the user for permission the first time; an app built with a target SDK of 33 or more can't show notifications at all, since gogio can't declare the POST_NOTIFICATIONS permission.
func (*App) OpenDownloads ¶
OpenDownloads shows where SaveToDownloads puts files: the Downloads app on Android, the app's folder in the Files app on iOS, and Downloads/<folder> in the file manager on desktops (folder is the app's name when empty).
func (*App) OpenFile ¶
func (a *App) OpenFile(ctx context.Context, filter ...FileFilter) (io.ReadCloser, error)
OpenFile shows the platform's file picker and returns the file the user chose, open for reading. On Android and iOS that's the system picker, the only way apps there can read the user's files; on desktops it's the native open dialog (through the XDG desktop portal on Linux).
OpenFile blocks until the user decides, so call it from a goroutine, never from a click handler or anything else running on the UI goroutine - the dialog needs the event loop running:
go func() {
f, err := app.OpenFile(ctx, giode.FileFilter{Extensions: []string{"wav", "mp3"}})
if errors.Is(err, giode.ErrCanceled) {
return
}
...
}()
It returns ErrCanceled when the user closes the picker, and ctx.Err() when ctx ends first (the picker may stay open; a file chosen after that is closed). One file dialog shows at a time; further calls wait for it.
func (*App) OpenFiles ¶
func (a *App) OpenFiles(ctx context.Context, filter ...FileFilter) ([]io.ReadCloser, error)
OpenFiles is OpenFile for choosing several files at once.
func (*App) OpenFolder ¶
OpenFolder opens the folder at path in the file manager: Explorer, Finder or the desktop's file manager; on iOS the Files app, for folders inside the app's Documents. Android returns ErrNotSupported: use OpenDownloads. To point at one file inside its folder, Share a ShareFile instead.
func (*App) OpenURL ¶
OpenURL opens rawURL in the app that handles it - the browser for web links, the mail or phone app for mailto: and tel: - on every platform: an ACTION_VIEW intent on Android, UIApplication openURL on iOS, and open, xdg-open or the URL handler on desktops. Only http, https, mailto, tel and sms links are opened; others return an error, so links from untrusted content can't reach local files or scripts.
Links in RichText and Markdown open through it unless the paragraph has its own OnLink handler.
func (*App) PickFiles ¶
func (a *App) PickFiles(ctx context.Context, opts PickOptions) ([]PickedFile, error)
PickFiles shows the platform's file picker (see OpenFile) and returns the picked files with their names, types and sizes - the display name and size from the picker on Android and iOS, from the file itself on desktops. Like OpenFile it blocks until the user decides: call it from a goroutine. It returns ErrCanceled when the user closes the picker.
files, err := app.PickFiles(ctx, giode.PickOptions{Types: []string{"image/*", "application/pdf"}, Multiple: true})
func (*App) PickFolder ¶
PickFolder shows the platform's folder picker and returns the path of the folder the user chose: IFileOpenDialog on Windows, NSOpenPanel on macOS, the XDG desktop portal on Linux (zenity or kdialog when no portal runs). Like OpenFile it blocks until the user decides: call it from a goroutine. It returns ErrCanceled when the user closes the picker, and ErrNotSupported on Android, iOS and the web, where apps get no plain paths to the user's folders.
In the macOS App Sandbox (Mac App Store builds), access to the folder would end when the app quits; giode keeps a security-scoped bookmark of it and reopens it at every start, so the path keeps working.
func (*App) PickPhoto ¶
func (a *App) PickPhoto(ctx context.Context, opts PhotoOptions) (PickedFile, error)
PickPhoto lets the user pick a photo (or take one, with Camera) and returns it as a JPEG, scaled to MaxSide and rotated upright. On Android it uses the system photo picker (Android 13+, or the image picker before that) and decodes HEIC there, so HEIC never reaches the app. On desktops it picks an image file (JPEG, PNG, GIF, WebP) and re-encodes it. It blocks until the user decides: call it from a goroutine. It returns ErrCanceled when the user backs out.
func (*App) PickPhotos ¶
func (a *App) PickPhotos(ctx context.Context, opts PhotoOptions, limit int) ([]PickedFile, error)
PickPhotos lets the user pick several photos at once, up to limit (0 for as many as the picker allows), and returns them in the order picked, each as an upright JPEG scaled to opts.MaxSide. On Android it uses the system photo picker (Android 13+, or the image picker before that); on iOS PHPicker (iOS 14+); on desktops an image file picker. opts.Source must be Library. It blocks until the user decides: call it from a goroutine. It returns ErrCanceled when the user picks none.
func (*App) PlaySound ¶
PlaySound plays a short sound - the contents of a WAV file - and returns without waiting for it to finish: a chime when a task is done, a click, an alert. The WAV holds PCM samples of 8, 16, 24 or 32 bits, or 32-bit floats, in one channel or two, at any common rate. Scale the samples for a quieter sound; EncodeWAV makes a WAV from samples generated in code.
Sounds overlap, except on Windows, where a sound stops the one still playing. It returns an error for data that isn't such a WAV, and ErrNotSupported where nothing can play it (on Linux it needs pw-play, paplay or aplay). Call it from any goroutine.
Where it plays: Windows' PlaySound; NSSound on macOS; AVAudioPlayer on iOS, mixed with other audio and silent in silent mode; AudioTrack on Android, as a notification sound; Web Audio in the browser (which plays sounds only after the user has interacted with the page); PipeWire, PulseAudio or ALSA on Linux.
func (*App) Post ¶
func (a *App) Post(fn func())
Post queues fn to run on the UI goroutine before the next frame and requests that frame, without waiting. While the window is hidden or minimized, and there are no frames, it runs as soon as the UI goroutine wakes up. It is safe to call from any goroutine: use it to apply results from background work (a network response, a file read) to data the view reads, so that data never needs locks. Calls run in the order posted.
func (*App) Quit ¶
func (a *App) Quit()
Quit closes the window and ends the app, even with CloseToTray.
func (*App) Raise ¶
func (a *App) Raise()
Raise brings the window to the front, restoring it first when it's minimized. On Windows it may be called from any goroutine; elsewhere call it on the UI goroutine (from a handler, or through Post).
Windows lets an app take the foreground only when the user just interacted with it, or another app passed it the right (a second launch does, see SingleInstanceLock); otherwise the taskbar button flashes instead.
func (*App) ReadClipboard ¶
ReadClipboard reads the system clipboard's text and calls fn with it on the UI goroutine (with "" when the clipboard holds no text). It is safe to call from any goroutine and doesn't block; the read starts on the next frame, which it requests.
func (*App) ReadClipboardImage ¶
ReadClipboardImage returns the image on the system clipboard - a screenshot, or an image copied from a browser, a document or an image editor - or nil when the clipboard holds no image. It returns ErrNotSupported where giode can't read images from the clipboard.
It reads the clipboard directly and may wait for the app that owns it, so call it from a goroutine, like OpenFile:
go func() {
img, err := app.ReadClipboardImage(ctx)
if err != nil || img == nil {
return
}
...
}()
Where it comes from: Windows' clipboard (PNG, else a device- independent bitmap); macOS's and iOS's pasteboards; Android's clipboard (an image content URI, as Android's screenshot and photo apps copy); the browser's async clipboard (the page must be focused, and the browser may ask the user); on Linux, wl-paste (Wayland) or xclip (X11), which must be installed.
func (*App) RequestClose ¶
func (a *App) RequestClose()
RequestClose closes the window as the system's close button does: with CloseToTray it hides the window to the tray, otherwise it ends the app, as Close does. TitleBar's close button calls it. It may be called from any goroutine.
func (*App) ResetFrameStats ¶
func (a *App) ResetFrameStats()
ResetFrameStats discards the frames measured so far, to measure one interaction (a streamed reply, a scroll) on its own.
func (*App) RestartElevated ¶
RestartElevated starts a new copy of the app with administrator rights and quits this one, for work that needs them (raw disk access, system settings). The system asks the user first: UAC on Windows, pkexec (polkit) on Linux, an administrator password prompt on macOS. args are the new copy's arguments, os.Args[1:] when nil.
It returns once the new copy is starting, or ErrDeclined when the user refuses, leaving this copy running. With a SingleInstanceLock the new copy waits for this one to quit and takes the lock over. It returns ErrNotSupported on Android, iOS and the web.
Running a whole GUI as root is what some disk tools need, but it's a big hammer: prefer a small elevated helper when the work allows.
func (*App) Run ¶
Run drives the event loop and renders view every frame until the window closes. view runs on every frame: build the UI from scratch, but reuse stateful components created before Run.
Run blocks for the lifetime of the application: when the window closes it releases the single-instance lock, runs OnShutdown and terminates the process. Any window close error is printed to stderr.
func (*App) RunOnUI ¶
RunOnUI runs fn on the UI goroutine before the next frame is laid out (or straight away while the window is hidden) and waits for it, so code running elsewhere (an MCP tool, a network callback) can safely drive stateful components. It fails if the UI goroutine doesn't run it before ctx is done.
func (*App) SaveFile ¶
SaveFile shows the platform's save dialog, suggesting name, and returns the file the user chose, open for writing; close it when done. On Android that's the system's "create document" picker. Like OpenFile, it blocks until the user decides: call it from a goroutine.
func (*App) SaveToDownloads ¶
SaveToDownloads copies the file at path into the user's Downloads folder, under folder (the app's name when empty), and returns where it went. Use it for files the user receives or exports and expects to find with their other downloads.
- Android: Download/<folder> through MediaStore, where the Files and Downloads apps show it; Android 10 or later, no permission. It returns the content:// URI.
- iOS: the app's Documents/<folder>, which the Files app shows under the app when Info.plist has UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace (set both to true under [ios.plist] in giode.toml). It returns the file's path.
- Desktops: the Downloads folder (Windows' known folder, XDG_DOWNLOAD_DIR on Linux, ~/Downloads on macOS). It returns the file's path.
A file of the same name isn't overwritten: the copy gets " (2)" and so on. It copies the whole file: call it from a goroutine.
func (*App) SaveToPhotos ¶
SaveToPhotos adds the picture or video at path to the device's photo gallery, where photo apps show it: a scanned page exported as JPEG, say. The type comes from the extension (.jpg, .png, .heic, .mp4, .mov ...).
On Android it goes to Pictures/<album> (Movies for videos) through MediaStore, Android 10 or later, with no permission needed. On iOS it's added to the photo library, asking for add-only access the first time: set ios.usage.photos_add in giode.toml (NSPhotoLibraryAddUsageDescription). On desktops it's copied into the user's Pictures folder, under album. album is a folder name, the app's name when empty; iOS ignores it.
It copies the whole file: call it from a goroutine.
func (*App) Screen ¶
Screen returns the screen showing the window, in dp. It's supported on Windows, macOS and X11; on Android, iOS and the web the window is the screen, which it returns with the system bars taken out of the work area. Wayland doesn't tell apps where their windows are: there it returns ErrNotSupported. Safe to call from any goroutine.
func (*App) SetAlwaysOnTop ¶
SetAlwaysOnTop keeps the window above other windows, or stops it, as Config.AlwaysOnTop does at start. It works on Windows, macOS and X11; Wayland leaves the choice to the user. Safe to call from any goroutine.
func (*App) SetClipboard ¶
SetClipboard copies text to the system clipboard. It is safe to call from any goroutine; the copy happens on the next frame, which it requests. Inside a Layout, kit.WriteClipboard copies immediately.
func (*App) SetCloseToTray ¶
SetCloseToTray turns Config.CloseToTray on or off while the app runs: closing the window then hides it to the tray, or ends the app. It may be called from any goroutine.
func (*App) SetContextMenu ¶
SetContextMenu registers a menu to open with a right-click anywhere in the window. The app registers the right-click area and renders the menu on top automatically.
func (*App) SetFullscreen ¶
SetFullscreen switches the window in or out of fullscreen mode.
func (*App) SetLaunchAtLogin ¶
SetLaunchAtLogin registers the app to start when the user signs in, or removes the registration: a Run key entry on Windows (or, in an MSIX package, its startup task: set windows.msix.startup_task in giode.toml), a LaunchAgent on macOS (a login item with SMAppService in the App Sandbox, as Mac App Store builds are: macOS 13 and later, ErrNotSupported before), an XDG autostart entry on Linux (running the AppImage or the Flatpak when the app is one). The app then starts with LaunchedAtLogin true. It returns ErrNotSupported on Android, iOS and the web.
The user can also change it in the system's settings, so read LaunchAtLogin for the current state rather than remembering it.
func (*App) SetMaxFPS ¶
SetMaxFPS caps the frame rate at fps frames a second; 0 draws at the display's refresh rate. See Config.MaxFPS. It may be called from any goroutine and applies from the next frame.
func (*App) SetMinimizeToTray ¶
SetMinimizeToTray turns Config.MinimizeToTray on or off while the app runs. It may be called from any goroutine.
func (*App) SetPosition ¶
SetPosition moves the window so its top left corner (of the title bar and border) is at x, y in dp on the desktop, from the primary screen's top left. It's supported on Windows, macOS and X11, and returns ErrNotSupported elsewhere: Wayland compositors place windows themselves. Safe to call from any goroutine; the move happens shortly after.
func (*App) SetSize ¶
SetSize resizes the window to w x h dp, leaving fullscreen or maximized state first. The size bounds from Config (MinSize, MaxSize, MinWidth, ...) are widened when they'd prevent it, so automation can shrink a desktop app to a phone's size; a window that isn't Resizable stays locked, at the new size.
func (*App) SetTitle ¶
SetTitle changes the window's title, shown in its title bar, the taskbar and the window switcher - the playing file's name, say. Config.Title is the first. Safe to call from any goroutine.
func (*App) Share ¶
Share hands item to the system, the usual way to get something out of an app on a phone:
err := app.Share(ctx, giode.ShareFile{Path: p, MIME: "audio/wav"})
On Android it opens the system share sheet. A shared file is first copied into the device's Downloads folder (apps built with gogio can't declare the FileProvider Android otherwise needs to hand files to other apps), which needs Android 10 or later.
On desktops, ShareText copies the text to the clipboard and ShareFile shows the file in the file manager. On iOS it opens the share sheet (a popover on iPad). On the web Share returns ErrNotSupported.
Share can take a while for a large file, so call it from a goroutine rather than a click handler.
func (*App) ShowWindow ¶
func (a *App) ShowWindow()
ShowWindow shows a window hidden with HideWindow (or by MinimizeToTray, CloseToTray), restores it from minimized, and brings it to the front.
func (*App) ToggleMaximize ¶
func (a *App) ToggleMaximize()
ToggleMaximize maximizes a restored window and restores a maximized (or fullscreen) one - the action behind a title bar's maximize button.
func (*App) UninstallContextActions ¶
UninstallContextActions removes what InstallContextActions added.
func (*App) Unmaximize ¶
func (a *App) Unmaximize()
Unmaximize restores the window from its maximized state.
func (*App) WindowState ¶
func (a *App) WindowState() WindowState
WindowState returns the window's current state. It is safe to call from any goroutine.
func (*App) WindowVisible ¶
WindowVisible reports whether the window is on screen: not hidden and not minimized.
type AppShellConfig ¶
type AppShellConfig = ui.AppShellConfig
type AppShellSlot ¶
type AppShellSlot = ui.AppShellSlot
type BackgroundFit ¶
type BackgroundFit = ui.BackgroundFit
Style value and element types, for declaring variables and helpers that take them.
type BackgroundImage ¶
type BackgroundImage = ui.BackgroundImage
Style value and element types, for declaring variables and helpers that take them.
type BoxElement ¶
type BoxElement = ui.BoxElement
Style value and element types, for declaring variables and helpers that take them.
type Breakpoint ¶
type Breakpoint = ui.Breakpoint
type ButtonElement ¶
type ButtonElement = ui.ButtonElement
type ButtonVariant ¶
type ButtonVariant = ui.ButtonVariant
type CanvasPath ¶
type CanvasPath = ui.CanvasPath
Style value and element types, for declaring variables and helpers that take them.
type ClickEvent ¶
type ClickEvent = ui.ClickEvent
type ClickSource ¶
type ClickSource = ui.ClickSource
type Color ¶
Color is a CSS-like color: "#3b82f6", "rgb(59 130 246)", a name, or a "theme.*" token that follows the palette.
type Config ¶
type Config struct {
// Title is the window title.
Title string
// Size is the initial window size. Defaults to 800x600.
Size image.Point
// MinSize and MaxSize bound the window size when Resizable. They
// combine with MinWidth/MinHeight/MaxWidth/MaxHeight below; the
// tighter bound wins.
MinSize image.Point
MaxSize image.Point
// MinWidth, MinHeight, MaxWidth and MaxHeight bound the window
// size per axis.
MinWidth int
MinHeight int
MaxWidth int
MaxHeight int
// Resizable controls whether the user can resize the window. When
// false the size is locked to Size.
Resizable bool
// Frameless removes the OS window frame (title bar and borders).
Frameless bool
// Draggable makes the window movable by dragging empty
// (non-widget) space anywhere in it. It only applies to frameless
// windows. To drag by a custom title bar only, leave it off and
// use TitleBar, which marks its own area as the drag handle.
Draggable bool
// Background is the window background color. Theme tokens
// ("theme.background") follow SetMode and SetPalette. On Windows,
// built with the giode CLI's Gio patches, a new window shows it
// (as it is when New runs) until the first frame, rather than
// white.
Background string
// StatusBar and NavigationBar color Android's status bar and
// navigation bar. Both default to Background and follow theme
// changes, so the bars blend with a light or dark app. Other
// platforms ignore them.
StatusBar string
// Orientation restricts rotation on mobile platforms. Defaults to
// OrientationAny. Desktop platforms ignore it.
Orientation Orientation
// FollowSystemTheme sets the theme mode (SetMode) from the
// platform's light or dark appearance at startup and whenever it
// changes. See SystemDarkMode for the platforms that report it.
FollowSystemTheme bool
// OnSystemThemeChange runs on the UI goroutine when the platform's
// appearance changes between light and dark, with or without
// FollowSystemTheme.
OnSystemThemeChange func(dark bool)
// EdgeToEdge lays the view out over the whole window, under the
// status bar, navigation bar and cutouts, instead of inside the
// safe area. Pad content with SafeArea where it must stay clear of
// them. Desktop windows have no insets, so it changes nothing there.
EdgeToEdge bool
// Icon is the window icon, PNG or JPEG bytes. It is applied at
// runtime where the platform supports it (Windows). The icon
// shown by file managers comes from the executable and is set at
// build time.
Icon []byte
// WindowStartState selects the initial window state. It takes
// precedence over the Fullscreen, Maximized and Minimized flags.
WindowStartState WindowStartState
// Fullscreen starts the window in fullscreen mode.
Fullscreen bool
// Maximized starts the window maximized.
Maximized bool
// Minimized starts the window minimized.
Minimized bool
// Center starts the window centered on the screen.
Center bool
// AlwaysOnTop keeps the window above other windows.
AlwaysOnTop bool
// Logger receives Giode diagnostics at or above LogLevel.
Logger Logger
// LogLevel filters Logger output. Defaults to LogLevelDebug.
LogLevel LogLevel
// OnStartup runs before the event loop starts.
OnStartup func()
// OnReady runs after the first frame is presented to the screen.
OnReady func()
// OnShutdown runs after the window closes. On Android and iOS the
// system may end a backgrounded app without warning, so save state
// in OnBackground instead.
OnShutdown func()
// OnBackground runs when the app leaves the screen: on Android when
// its activity stops (the user switched apps, went home, or opened
// a system picker), on desktops when the window is minimized. On
// Android it's the last reliable moment to save: the system may
// freeze or end the app afterwards without warning. It runs
// synchronously on the platform's main thread (Android) or the UI
// goroutine (desktop): keep it short, and don't wait on the UI
// (RunOnUI) from it. On iOS it runs on UIApplication's
// background notification.
OnBackground func()
// OnForeground runs when the app comes back after OnBackground,
// on the same goroutine.
OnForeground func()
// OnEvent observes every window event before giode handles it, on
// the UI goroutine - for Gio extensions that need to see them. It
// must not call FrameEvent.Frame. OpenFile and SaveFile already
// get the events they need.
OnEvent func(event.Event)
// OnBeforeClose runs when a window close is requested. It cannot
// veto the close.
OnBeforeClose func()
// OnKey receives the keys nothing in the UI took - app-wide
// shortcuts - after the focused field, dialogs, menus and the
// Escape and Back handlers have had theirs; see giode.OnKey. It
// runs on the UI goroutine and returns whether it used the key.
OnKey func(e key.Event) bool
// OnWindowStateChange runs when the window is minimized,
// maximized, made fullscreen or restored - by the app or by the
// user.
OnWindowStateChange func(WindowState)
// Locale is the app's locale ("fa", "pt-BR") for the i18n package
// and the layout's reading direction; the system's by default. Change
// it later with SetLocale.
Locale string
// Intl, when set, turns on translations: giode loads the message
// files (<locale>.json) from a folder at startup, and Intl(key,
// data) reads them. Nil leaves translation off.
Intl *IntlOptions
// OnOpenURL runs on the UI goroutine with a link that opened the
// app or reached it while running: a URL scheme it registered
// (giode.toml's app.schemes) or one of its universal links / Android
// App Links (app.links). With a SingleInstanceLock, a link that
// starts a second desktop instance reaches the running one here.
OnOpenURL func(u *url.URL)
// shared with this one from the system share sheet - files, text or
// both - whether the share started the app or reached it while
// running. The app must be a share target: giode.toml's
// app.share_target, which registers it on Android and builds iOS's
// share extension. The receiver closes the files.
OnShareReceived func(SharedContent)
// ContextActions add entries to the file manager's right-click menu
// that open the app with the chosen paths; see ContextAction. The
// giode CLI adds the ones in giode.toml too.
ContextActions []ContextAction
// OnContextAction runs on the UI goroutine when the app was started
// from one of its context actions, with the action's ID and the
// paths it was chosen on. With a SingleInstanceLock, a context
// action chosen while the app runs reaches the running instance
// here.
OnContextAction func(id string, paths []string)
// MinimizeToTray hides the window when it's minimized, so it leaves
// the taskbar or Dock and lives in the tray until ShowWindow (by
// default a click on the tray icon) brings it back. It needs a tray
// icon: set one up with App.Tray. Desktop only. App.SetMinimizeToTray
// changes it while the app runs.
MinimizeToTray bool
// CloseToTray hides the window when the user closes it, instead of
// ending the app; Quit (a tray menu item, say) ends it. Windows and
// macOS; on Linux, where Gio can't keep a closed window, closing
// still quits. App.SetCloseToTray changes it while the app runs.
CloseToTray bool
// StartInTray starts the app with its window hidden, in the tray:
// StartInTrayAtLogin when the system started it at login (see
// App.SetLaunchAtLogin), StartInTrayAlways every time. The window
// shows with ShowWindow, from the tray icon. It needs a tray icon
// (App.Tray) and is ignored where TraySupported is false.
StartInTray StartInTray
// MenuBarApp makes a macOS app live in the menu bar: no Dock icon
// and no app menu, as menu bar utilities do. Pair it with App.Tray.
// Other platforms ignore it.
MenuBarApp bool
// SingleInstanceLock, when set, ensures only one instance of the
// application runs on desktops. Android and iOS ignore it: they run
// one copy of an app anyway. When the lock can't be written (no
// usable temporary directory), the app runs as if it were alone.
SingleInstanceLock *SingleInstanceLock
// OnFileDrop runs with the paths of files dropped onto the window
// from the file manager, on the UI goroutine. It works on Windows
// (when the app runs as administrator too), macOS, and on Linux on
// X11 and Wayland when an up to date giode CLI builds the app: its
// Gio patches receive the drops. Elsewhere a warning is logged once.
OnFileDrop func(paths []string)
// OnFileDrag runs on the UI goroutine as files are dragged over
// the window - entering, moving, leaving, dropped - for
// highlighting where they can go; App.FileDrag reports the same
// during layout. Setting it accepts drops as OnFileDrop does. On
// Windows, an app running as administrator gets only the drop.
OnFileDrag func(FileDrag)
// MCP starts a Model Context Protocol server alongside the window,
// so AI agents can see and drive the running app: inspect the UI,
// click, type, take screenshots, read and set named state - plus
// any tools added with App.MCPTool. It listens on
// http://127.0.0.1:7600/mcp unless MCPOptions say otherwise.
// Setting the GIODE_MCP=1 environment variable enables it too,
// without rebuilding.
MCP bool
// MCPOptions configures the MCP server.
MCPOptions MCPOptions
// ShowFrameTimes draws a small counter in the top right corner with
// how long frames take to build and to render, and the frame rate:
// a development aid for finding what makes scrolling or a stream
// stutter on a device. App.FrameStats returns the same numbers, and
// the MCP server reports them as frame_stats.
ShowFrameTimes bool
// MaxFPS caps the frame rate: frames are drawn at most this many
// times a second, saving CPU, GPU and battery during animations,
// scrolling and video. 0 (the default) draws at the display's
// refresh rate. Frames still follow the display's refresh, so on a
// 60 Hz display a cap of 30 gives 30 fps but one of 50 gives 30 too:
// each frame waits for the refresh after its interval. Change it
// while the app runs with SetMaxFPS.
MaxFPS int
// Underlay draws caller-rendered GPU content under the UI each
// frame - video frames from libmpv, a 3D or map engine - without
// copying it off the GPU. It's called on the window's render thread
// with the window's GPU context current, before the UI is drawn
// over its output; Background isn't painted, so the UI's own
// backgrounds cover only what they should. Call App.Invalidate from
// any goroutine when a new frame is ready. Engines drawing with
// OpenGL set Renderer to RendererOpenGL. It needs giode's patched
// Gio (giode build and giode run); without it Run returns an error.
Underlay func(target GPUTarget)
// UnderlayRelease runs on the render thread with the GPU context
// still current, just before Gio releases its GPU resources: when
// the window closes or its view goes away (Android leaving the
// screen), or the context is lost and made again, after which
// Underlay runs in the new one. Free the engine's GPU resources
// here (for libmpv, mpv_render_context_free). It needs an up to
// date giode CLI (the giode_gio2 patches); with older ones Run
// returns an error.
UnderlayRelease func()
// Renderer selects the window's GPU API; see RendererOpenGL.
Renderer Renderer
}
Config configures the application window. The options cover the common window settings of desktop applications; unsupported platform features are simply ignored.
type Constraints ¶
type Constraints = ui.Constraints
Context is what an element's Layout gets: the constraints it must fit, the display metric, the ops to draw into and the input source (Gio's layout.Context). Dimensions is what Layout returns: the size it took and its baseline. With these, a custom element needs nothing from Gio:
func (r *Rating) Layout(gtx giode.Context) giode.Dimensions { ... }
type Context ¶
Context is what an element's Layout gets: the constraints it must fit, the display metric, the ops to draw into and the input source (Gio's layout.Context). Dimensions is what Layout returns: the size it took and its baseline. With these, a custom element needs nothing from Gio:
func (r *Rating) Layout(gtx giode.Context) giode.Dimensions { ... }
type ContextAction ¶
type ContextAction struct {
// ID identifies the action to OnContextAction. Letters, digits, -
// and _.
ID string `json:"id"`
// Label is the menu text.
Label string `json:"label"`
// Files offers the action on files; Extensions limits it to files
// with these extensions (".md"). Without Files, Folders or
// FolderBackground, it's offered on files.
Files bool `json:"files,omitempty"`
Extensions []string `json:"extensions,omitempty"`
// Folders offers the action on folders.
Folders bool `json:"folders,omitempty"`
// FolderBackground offers it on the empty space of an open folder;
// the path is that folder. Windows and Dolphin only.
FolderBackground bool `json:"background,omitempty"`
}
ContextAction is an entry the app adds to the file manager's right-click menu - "Ask Pocket Agent about this file", "Open in Notes" - on files, folders, or the empty space inside a folder. Choosing it starts the app (or, with a SingleInstanceLock, hands the paths to the running one) and runs Config.OnContextAction with the action's ID and the paths.
Declare actions in giode.toml, where the giode CLI also writes them into the Windows installer and the macOS app, or in Config.ContextActions. They appear:
- on Windows, in Explorer's context menu ("Show more options" on Windows 11): installed by the setup program, or by App.InstallContextActions for the current user;
- on macOS, under Quick Actions / Services in Finder's context menu, from the app's Info.plist (built by the giode CLI) once the app is in /Applications and has run once;
- on Linux, in GNOME Files and Caja (under Scripts), Dolphin and Nemo, once App.InstallContextActions has run.
type ContextMenu ¶
type ContextMenu = ui.ContextMenu
ContextMenu is what an element's Context takes: a Menu, or a menu of your own.
type Contextual ¶
type Contextual = ui.Contextual
Contextual gives a custom element Context; see extending.md.
type DeviceClass ¶
type DeviceClass string
DeviceClass is a device's form factor.
const ( DevicePhone DeviceClass = "phone" DeviceTablet DeviceClass = "tablet" DeviceDesktop DeviceClass = "desktop" )
type DeviceInfo ¶
type DeviceInfo struct {
// TotalRAM is the physical memory in bytes, 0 if unknown.
TotalRAM uint64
// Class is the form factor: phone or tablet on Android and iOS (by
// the window's shorter side, 600dp and up being a tablet), desktop
// elsewhere.
Class DeviceClass
// OS is runtime.GOOS; OSVersion its version ("14", "10.0.22631",
// "6.8.0-45-generic"), and Model the hardware model ("Pixel 8",
// "MacBookPro18,3"), each "" when unknown.
OS string
OSVersion string
Model string
}
DeviceInfo describes the device the app runs on.
func Device ¶
func Device() DeviceInfo
Device returns information about the device, for choosing a suitable on-device model or layout. Class uses the window size, so call it once the first frame has been laid out (in OnReady or the view).
type Dimensions ¶
type Dimensions = ui.Dimensions
Context is what an element's Layout gets: the constraints it must fit, the display metric, the ops to draw into and the input source (Gio's layout.Context). Dimensions is what Layout returns: the size it took and its baseline. With these, a custom element needs nothing from Gio:
func (r *Rating) Layout(gtx giode.Context) giode.Dimensions { ... }
type DividerElement ¶
type DividerElement = ui.DividerElement
Style value and element types, for declaring variables and helpers that take them.
type FileDrag ¶
type FileDrag struct {
Kind FileDragKind
// Position is where the pointer is, in window pixels as layout
// uses them (compare it with a component's bounds).
Position f32.Point
}
FileDrag is files from the file manager dragged over the window, for highlighting where they can be dropped.
type FileDragKind ¶
type FileDragKind int
FileDragKind is the stage of a FileDrag.
const ( // FileDragEnter: files were dragged into the window. FileDragEnter FileDragKind = iota + 1 // FileDragOver: they moved over it. FileDragOver // FileDragLeave: they left without being dropped, or the drag was // canceled. FileDragLeave // FileDragDrop: they were dropped; OnFileDrop follows with their // paths. FileDragDrop )
type FileFilter ¶
type FileFilter struct {
// Extensions lists the accepted file extensions, with or without
// the leading dot: "wav", ".mp3". Empty accepts any file.
Extensions []string
}
FileFilter limits the files OpenFile and OpenFiles offer.
type FlexDirection ¶
type FlexDirection = ui.FlexDirection
Style value and element types, for declaring variables and helpers that take them.
type FolderOptions ¶
type FolderOptions struct {
// Title is the dialog's title or prompt: "Where should recovered
// files go?". Empty uses the system's.
Title string
// Directory is the folder the dialog opens in; empty lets the
// system choose.
Directory string
}
FolderOptions configures PickFolder.
type FontWeight ¶
type FontWeight = ui.FontWeight
Style value and element types, for declaring variables and helpers that take them.
type FrameStats ¶
type FrameStats struct {
// Frames is the number of frames measured: up to the last 240,
// since the app started or ResetFrameStats.
Frames int
// Build is the time spent building a frame: running the view
// function and laying it out, on the UI goroutine.
Build FrameTiming
// Render is the time spent handing the frame to the GPU: Gio
// encodes it, submits it and presents it. Presenting waits when the
// GPU is behind, so a GPU-bound UI shows up here; it may also wait
// for the display's refresh, so on a vsynced display Render alone
// can reach the refresh interval while the app is otherwise idle.
Render FrameTiming
// Interval is the time from one frame's start to the next, while
// frames follow each other (an animation, a stream, a scroll):
// gaps over a quarter second, when the app had nothing to draw, are
// left out.
Interval FrameTiming
// FPS is the frame rate over those intervals; 0 without any.
FPS float64
}
FrameStats summarizes how long recent frames took, from App.FrameStats.
type FrameTiming ¶
FrameTiming is the average, 95th percentile and worst of a frame phase.
type GPUTarget ¶
type GPUTarget struct {
API GPUAPI
// Framebuffer is the OpenGL (ES) framebuffer object to draw into; 0
// is the window's default framebuffer.
Framebuffer uint32
// Texture is the Metal MTLTexture (id<MTLTexture>) or the Direct3D
// 11 ID3D11RenderTargetView to draw into, or the Vulkan VkImage.
Texture uintptr
// Size is the target's size in pixels.
Size image.Point
// GetProcAddress looks up an OpenGL (ES) function of the window's
// context by name - what engines ask for to load GL themselves
// (libmpv's get_proc_address): through ANGLE's libEGL.dll on
// Windows, EGL on Linux and Android, the OpenGL framework on macOS
// and OpenGLES on iOS. It returns nil for a name it doesn't know.
// It's nil for other APIs.
GetProcAddress func(name string) unsafe.Pointer
}
GPUTarget is the frame Config.Underlay draws into: the window's render target, with its GPU context current.
type HapticKind ¶
type HapticKind int
HapticKind is a kind of haptic feedback.
const ( // HapticLight is a light tap, for selections and key presses. HapticLight HapticKind = iota // HapticMedium is a firmer tap, for confirming a control. HapticMedium // HapticHeavy is the long-press feedback. HapticHeavy // HapticSuccess confirms a completed action (send, approve). HapticSuccess // HapticWarning flags a rejected or risky action. HapticWarning )
type IconButtonVariant ¶
type IconButtonVariant = ui.IconButtonVariant
type IconDocument ¶
type IconDocument = ui.IconDocument
type IconRegistry ¶
type IconRegistry = ui.IconRegistry
type IconSource ¶
type IconSource = ui.IconSource
type InputAPI ¶
InputAPI groups the constructors for components whose purpose is collecting a value from the user.
type IntlOptions ¶
type IntlOptions struct {
// Dir is the folder holding the message files, "locales" by
// default. A relative folder is looked for in the working
// directory, next to the executable, then in a macOS app bundle's
// Resources folder. With FS, it's a folder inside FS.
Dir string
// FS, when set, is read instead of the disk: an embedded folder
// (//go:embed locales), which ships inside the executable and so
// also works on Android, iOS and the web, where apps have no
// folder beside them.
FS fs.FS
// Fallback is the locale used for keys the current one lacks,
// "en" by default.
Fallback string
}
IntlOptions turns on translations (Config.Intl): message files named by locale - locales/en.json, locales/fa.json, locales/pt-BR.json - each a JSON object of keys to text with {placeholders}, or to plural forms:
{
"greeting": "Hello, {name}!",
"unread": {"one": "{count} message", "other": "{count} messages"}
}
type KeyShortcut ¶
type KeyShortcut = ui.KeyShortcut
KeyShortcut is a keyboard shortcut made with Shortcut.
type Keyboard ¶
Keyboard selects the on-screen keyboard for Input.Text fields; see input.Input.Keyboard.
type KeyedCache ¶
type KeyedCache[K comparable, V any] = ui.KeyedCache[K, V]
KeyedCache is a typed map of per-item state that drops entries not asked for in a while; hold one in a stateful component.
func NewKeyedCache ¶
func NewKeyedCache[K comparable, V any]() *KeyedCache[K, V]
NewKeyedCache returns an empty KeyedCache.
type LazyAnchor ¶
type LazyAnchor = ui.LazyAnchor
type LazyListElement ¶
type LazyListElement = ui.LazyListElement
type LinearGradient ¶
type LinearGradient = ui.LinearGradient
type MCPOptions ¶
type MCPOptions struct {
// Addr is the HTTP listen address, "127.0.0.1:7600" by default.
// Host and Port, when set, replace its parts; port 0 in Addr
// ("127.0.0.1:0") picks any free port (see App.MCPAddress). At run
// time the GIODE_MCP_ADDR, GIODE_MCP_HOST and GIODE_MCP_PORT
// environment variables override all three. Binding beyond
// loopback ("0.0.0.0") exposes the app to the network: set Token
// when doing so.
Addr string
// Host is the address to listen on: "127.0.0.1" by default,
// "0.0.0.0" for every interface.
Host string
// Port is the TCP port, 7600 by default.
Port int
// Token, when set, is required from clients as a bearer token.
Token string
// Stdio serves the protocol on stdin/stdout instead of HTTP, for
// MCP clients that launch the app as a subprocess. Nothing else
// may write to stdout then.
Stdio bool
// Name and Version identify the server; Name defaults to the
// window title.
Name, Version string
// Instructions are sent to clients to explain the app; a default
// describing the built-in tools is used when empty.
Instructions string
// ReadOnly registers only the tools that observe the app (UI
// snapshot, screenshot, state reads), none that act on it.
ReadOnly bool
// DisableBuiltinTools registers no built-in tools, leaving only
// those added with App.MCPTool.
DisableBuiltinTools bool
// AllowedOrigins lists extra browser origins allowed to call the
// HTTP endpoint (localhost origins always are).
AllowedOrigins []string
// Timeout bounds how long a tool waits for the UI thread. Defaults
// to 5 seconds.
Timeout time.Duration
}
MCPOptions configures the built-in MCP server enabled with Config.MCP. The zero value serves Streamable HTTP on 127.0.0.1:7600 at /mcp with every built-in tool.
type MarkdownOptions ¶
type MarkdownOptions = ui.MarkdownOptions
MarkdownOptions configures Markdown.
type MouseButton ¶
type MouseButton = ui.MouseButton
type NamedKey ¶
NamedKey is a key, with exactly the modifiers to hold, that an OnKey handler asks for by name: Tab and Shift+Tab reach only a handler that names them. See OnKey.
type Orientation ¶
type Orientation int
Orientation restricts how a mobile app may be rotated.
const ( // OrientationAny lets the app follow the device's rotation. OrientationAny Orientation = iota // OrientationPortrait keeps the app in portrait. OrientationPortrait // OrientationLandscape keeps the app in landscape. OrientationLandscape )
type PhotoOptions ¶
type PhotoOptions struct {
Source PhotoSource
// MaxSide scales the photo down so its longer side is at most this
// many pixels; 0 keeps its size.
MaxSide int
}
PhotoOptions configures PickPhoto.
type PhotoSource ¶
type PhotoSource int
PhotoSource selects where PickPhoto takes the photo from.
const ( // PhotoLibrary picks an existing photo: the system photo picker on // Android, an image file elsewhere. PhotoLibrary PhotoSource = iota // Camera takes a new photo with the camera: Android, and iOS when // the app's Info.plist has NSCameraUsageDescription. Camera )
type PickOptions ¶
type PickOptions struct {
// Types limits the files offered, as MIME types ("application/pdf",
// "image/*") or extensions ("md", ".txt"). Empty allows any file.
Types []string
// Multiple lets the user pick several files.
Multiple bool
}
PickOptions configures PickFiles.
type PickedFile ¶
type PickedFile struct {
io.ReadCloser
// Name is the display name ("Q3 report.pdf"), without a directory.
Name string
// MIME is the content type, from the name's extension or, failing
// that, the first bytes of the content.
MIME string
// Size is the length in bytes, or -1 when unknown.
Size int64
// Path is the file's absolute path on desktops, for work that
// needs the file itself rather than a stream (opening a disk image
// at random offsets, reopening it later). It's empty on Android,
// iOS and the web, whose pickers give content without a path.
Path string
}
PickedFile is a file the user picked, open for reading, with what's known about it.
type Placement ¶
Placement is the side of its trigger a tooltip (or any portal placed with elements.RegisterPortalAround) goes.
type PressState ¶
type PressState = ui.PressState
MemoCache caches a subtree's painted output across frames; see Memo.
type PressableElement ¶
type PressableElement = ui.PressableElement
type Rect ¶
type Rect struct {
X, Y, Width, Height float32
}
Rect is an area of the desktop in dp: X and Y are its top left corner, from the primary screen's top left.
type Renderer ¶
type Renderer int
Renderer selects the GPU API of the app's window.
const ( // RendererDefault is Gio's choice: Metal on macOS and iOS, Direct3D // 11 on Windows, OpenGL ES elsewhere. RendererDefault Renderer = iota // RendererOpenGL asks for OpenGL (ES) on every platform, for // engines that render with OpenGL (libmpv, most video, 3D and map // engines): on Windows through ANGLE (libEGL.dll and libGLESv2.dll // next to the executable), on macOS and iOS through the nometal // build tag (renderer = "opengl" in giode.toml). RendererOpenGL )
type RichTextElement ¶
type RichTextElement = ui.RichTextElement
Style value and element types, for declaring variables and helpers that take them.
type RichTextSpan ¶
type RichTextSpan = ui.RichTextSpan
RichTextSpan is one run of a RichText paragraph, made with Span or Link.
type Screen ¶
type Screen struct {
// Bounds is the whole screen.
Bounds Rect
// WorkArea is the part of it windows go in: without the taskbar,
// the Dock and menu bar, or desktop panels.
WorkArea Rect
// Scale is the screen's pixels per dp.
Scale float32
}
Screen describes the screen (monitor) showing the window.
type ScrollAlign ¶
type ScrollAlign = ui.ScrollAlign
type ScrollAnchor ¶
type ScrollAnchor = ui.ScrollAnchor
ScrollAxis selects the directions a Scroll scrolls in, and ScrollAnchor where it keeps growing content; see scroll.Scroll.Axis and Anchor.
type ScrollAxis ¶
type ScrollAxis = ui.ScrollAxis
ScrollAxis selects the directions a Scroll scrolls in, and ScrollAnchor where it keeps growing content; see scroll.Scroll.Axis and Anchor.
type SecureStorage ¶
type SecureStorage struct {
// Service names the app in the credential store, keeping its
// entries apart from other apps'. It defaults to the executable's
// name; set it before first use to something stable, such as a
// reverse-DNS app ID.
Service string
}
SecureStorage keeps small secrets - API keys, tokens - in the platform's credential store rather than a file: the Keychain on iOS and macOS (accessible after first unlock, this device only, on iOS), the Android Keystore (values encrypted with a key that never leaves the device), the Secret Service (GNOME Keyring, KWallet) on Linux, and DPAPI-encrypted files on Windows. Values copied off the device, such as in a backup, can't be read elsewhere.
Use the SecureStore value; its methods may be called from any goroutine, but can block (a Linux keyring may prompt to unlock), so keep them off the UI goroutine.
func (*SecureStorage) Delete ¶
func (s *SecureStorage) Delete(name string) error
Delete removes the value stored under name; deleting a missing name is not an error.
type SemanticKind ¶
type SemanticKind = ui.SemanticKind
type SemanticNode ¶
type SemanticNode = ui.SemanticNode
type ShareFiles ¶
type ShareFiles struct {
// it's guessed from the extensions: their shared type, else the
// shared kind ("image/*"), else any.
MIME string
Title string
}
ShareFiles shares several files at once: the pages of a scan as JPEGs, a batch of exports. On desktops it shows the first in the file manager.
type Shareable ¶
type Shareable interface {
// contains filtered or unexported methods
}
Shareable is something App.Share can hand to the system: ShareText, ShareFile or ShareFiles.
type SharedContent ¶
type SharedContent struct {
// they arrive, while Android's permission to read them lasts. Their
// Path is empty. Close each one.
Files []PickedFile
SharedContent is what another app shared with this one through the system share sheet: files, text (a note, a link) or both. See Config.OnShareReceived.
type SheetMode ¶
SheetMode selects when a Select opens as a bottom sheet; see dropdown.Select.Sheet.
type SingleInstanceLock ¶
type SingleInstanceLock struct {
// UniqueID identifies the application; it must be unique per app.
UniqueID string
// OnSecondInstanceLaunch runs in the second instance in place of
// the UI.
OnSecondInstanceLaunch func()
// OnLaunchArgs runs in the running instance, on the UI goroutine,
// with the command-line arguments (without the program name) of a
// second instance that started and exited - a file opened with the
// app, a URL. The window comes to the front either way. Context
// actions go to Config.OnContextAction instead.
OnLaunchArgs func(args []string)
}
SingleInstanceLock prevents a second instance of the application from running. When a second instance launches, its OnSecondInstanceLaunch callback runs and the instance exits without showing a window.
type StartInTray ¶
type StartInTray int
StartInTray says when the app starts with its window hidden in the tray (Config.StartInTray).
const ( // StartInTrayNever shows the window at start (the default). StartInTrayNever StartInTray = iota // StartInTrayAtLogin starts in the tray when the app was started at // login, and shows the window when the user opens it. StartInTrayAtLogin // StartInTrayAlways always starts in the tray. StartInTrayAlways )
type State ¶
State is a minimal global-state primitive: an observable value readable/writable from anywhere, including a goroutine outside the render loop (a network response, a timer), not just from within a Layout call. Create it with NewState.
func NamedState ¶
NamedState returns a State registered under name, so tooling - the MCP server's state_list/state_set tools - can read and set it. T must be JSON-encodable for that.
type StyleTransition ¶
type StyleTransition = ui.StyleTransition
type SubmitMode ¶
type SubmitMode = ui.SubmitMode
SubmitMode selects which keys submit an Input; see input.Input.SubmitOn.
type SwipeAction ¶
type SwipeAction = ui.SwipeAction
SwipeAction is a button revealed behind a Swipeable row.
type TextDecoration ¶
type TextDecoration = ui.TextDecoration
Style value and element types, for declaring variables and helpers that take them.
type TextElement ¶
type TextElement = ui.TextElement
Style value and element types, for declaring variables and helpers that take them.
type TextOverflow ¶
type TextOverflow = ui.TextOverflow
type TextTransform ¶
type TextTransform = ui.TextTransform
type TitleBarButton ¶
type TitleBarButton = ui.TitleBarButton
type TitleBarVariant ¶
type TitleBarVariant = ui.TitleBarVariant
type TitleBarWindow ¶
type TitleBarWindow = ui.TitleBarWindow
type ToastPlacement ¶
type ToastPlacement = ui.ToastPlacement
type ToasterElement ¶
type ToasterElement = ui.ToasterElement
type Transcript ¶
Transcript is one result of Dictate: the text recognized so far, replaced by each later result, until the Final one.
type TransitionElement ¶
type TransitionElement = ui.TransitionElement
type TransitionKind ¶
type TransitionKind = ui.TransitionKind
type Tray ¶
type Tray struct {
// contains filtered or unexported fields
}
Tray is the app's icon in the system tray: the notification area on Windows, the menu bar on macOS (where it can show text too) and the status notifier area on Linux desktops that have one (KDE, most others with an extension; GNOME needs the AppIndicator extension). Get it with App.Tray; it appears once something is set on it:
app.Tray().
SetIcon(iconPNG).
SetTooltip("Pocket Agent").
SetMenu(
giode.TrayAction("Open", app.ShowWindow),
giode.TraySeparator(),
giode.TrayAction("Quit", app.Quit),
)
On Windows and Linux, clicking the icon shows or hides the window unless OnClick says otherwise, and the menu opens with a right-click. On macOS, as menu bar items do, a click opens the menu (or runs OnClick when set). Config.MinimizeToTray and Config.CloseToTray hide the window to the tray instead of minimizing or closing it.
Methods may be called from any goroutine; menu and click callbacks run on the UI goroutine. On Android, iOS and the web the tray does nothing: TraySupported reports false.
func (*Tray) OnClick ¶
OnClick sets what a click on the icon does, on the UI goroutine. By default it shows the window, or hides it when it's showing - except on macOS, where a click opens the menu unless OnClick is set.
func (*Tray) SetIcon ¶
SetIcon sets the icon from PNG bytes. Without one the tray uses Config.Icon. Small icons work best: 32x32 or 64x64.
func (*Tray) SetTemplateIcon ¶
SetTemplateIcon sets an icon that macOS tints to match the menu bar, light or dark: PNG bytes, black shapes on transparency. Elsewhere it is a plain icon.
func (*Tray) SetTitle ¶
SetTitle sets text shown next to the icon: in the macOS menu bar, and on Linux panels that show it. Use it for live information - an unread count, a timer, a status. Windows doesn't show it; set the tooltip there.
func (*Tray) SetTooltip ¶
SetTooltip sets the text shown when the pointer rests on the icon.
type TrayItem ¶
type TrayItem struct {
// Label is the item's text.
Label string
// Tooltip is shown on hover where the platform supports it.
Tooltip string
// Disabled greys the item out.
Disabled bool
// Checkable shows a check mark when Checked.
Checkable, Checked bool
// Separator makes the item a divider line; the other fields are
// ignored.
Separator bool
// Items makes the item a submenu.
Items []TrayItem
// OnClick runs on the UI goroutine when the item is chosen.
OnClick func()
}
TrayItem is an entry of the tray's menu. Build them with TrayAction, TrayCheckbox, TraySeparator and TraySubmenu, or fill in the fields.
func TrayAction ¶
TrayAction returns a menu item running fn.
func TrayCheckbox ¶
TrayCheckbox returns a menu item with a check mark when checked. It doesn't toggle itself: fn updates your state, and the next SetMenu shows it.
func TraySubmenu ¶
TraySubmenu returns a submenu of items.
type TreeRowState ¶
type TreeRowState = ui.TreeRowState
type TreeViewElement ¶
type TreeViewElement = ui.TreeViewElement
type VirtualListElement ¶
type VirtualListElement = ui.VirtualListElement
type Visibility ¶
type Visibility = ui.Visibility
type Watch ¶
type Watch[T comparable] = ui.Watch[T]
Watch tracks the fields a component caching its own output draws from; see MemoCache.LayoutOwn.
type WindowStartState ¶
type WindowStartState int
WindowStartState selects the initial state of the window.
const ( // WindowStartNormal starts the window in its normal state. WindowStartNormal WindowStartState = iota // WindowStartMinimized starts the window minimized. WindowStartMinimized // WindowStartMaximized starts the window maximized. WindowStartMaximized // WindowStartFullscreen starts the window fullscreen. WindowStartFullscreen )
type WindowState ¶
type WindowState int
WindowState is the current state of the window, as reported by the platform. It changes through App methods (Maximize, Minimize, SetFullscreen, ...) as well as through the user (a double-click on the title bar, snapping, the taskbar).
const ( // WindowNormal is a regular, restored window. WindowNormal WindowState = iota // WindowMinimized is a window minimized to the taskbar or dock. WindowMinimized // WindowMaximized fills the available screen area. WindowMaximized // WindowFullscreen covers the whole screen. WindowFullscreen )
Source Files
¶
- app.go
- appwindow.go
- background_nogio3.go
- clipboard.go
- clipboardimage.go
- clipboardimage_unix.go
- config.go
- contextactions.go
- contextactions_linux.go
- contextserver.go
- contextserver_other.go
- device.go
- device_linux.go
- dib.go
- dictate.go
- dictate_other.go
- downloads.go
- downloads_desktop.go
- drag.go
- elevate.go
- elevate_linux.go
- exif.go
- filedrag.go
- filedrop_linux.go
- filedrop_nogio2_linux.go
- files.go
- fileutil.go
- framerate.go
- frametimes.go
- giode.go
- glproc_unix.go
- glread.go
- glread_cgo.go
- haptic.go
- icon.go
- icon_other.go
- insets.go
- intl.go
- keepawake.go
- keepawake_unix.go
- login.go
- login_linux.go
- mcpbuiltins.go
- mcpcapture.go
- mcpinject_other.go
- mcpinput.go
- mcpnodes.go
- mcpscroll.go
- mcpserver.go
- mcpui.go
- native.go
- notify.go
- openedurl.go
- openfiles_other.go
- openurl.go
- openurl_desktop.go
- photos.go
- photos_desktop.go
- pick.go
- pick_other.go
- pickfolder.go
- pickfolder_linux.go
- pictures_unix.go
- reexport.go
- reveal_unix.go
- securestore.go
- securestore_unix.go
- share.go
- share_desktop.go
- sharetarget.go
- sharetarget_inbox.go
- singleinstance.go
- sound.go
- sound_unix.go
- systembars.go
- systemtheme.go
- systemtheme_linux.go
- tray.go
- tray_linux.go
- tray_systray.go
- tray_systray_other.go
- tray_x11.go
- underlay.go
- underlay_gl.go
- underlay_nogio.go
- version.go
- windowpos.go
- windowpos_linux.go
- windowpos_x11.go
- windowstate.go
- workspace_other.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package android calls Java from Go on Android: static methods of the app's own classes (from a jar in one of its packages, which giode build adds to the APK) and of the Android SDK, through the app's class loader.
|
Package android calls Java from Go on Android: static methods of the app's own classes (from a jar in one of its packages, which giode build adds to the APK) and of the Android SDK, through the app's class loader. |
|
Package biometric unlocks an app with the fingerprint reader or face recognition, as an app lock does:
|
Package biometric unlocks an app with the fingerprint reader or face recognition, as an app lock does: |
|
Package camera shows a live camera preview inside a Giode view and takes full-resolution pictures: a document scanner's viewfinder, a QR scanner, a photo booth.
|
Package camera shows a live camera preview inside a Giode view and takes full-resolution pictures: a document scanner's viewfinder, a QR scanner, a photo booth. |
|
components
|
|
|
accordion
Package accordion provides a stateful list of expand/collapse sections.
|
Package accordion provides a stateful list of expand/collapse sections. |
|
appshell
Package appshell provides a full-window application layout: an optional fixed header, navbar, aside and footer around a main content area that's automatically offset so it never sits under them.
|
Package appshell provides a full-window application layout: an optional fixed header, navbar, aside and footer around a main content area that's automatically offset so it never sits under them. |
|
autocomplete
Package autocomplete provides a stateful text field with a filtered, portal-rendered list of suggestions.
|
Package autocomplete provides a stateful text field with a filtered, portal-rendered list of suggestions. |
|
avatar
Package avatar provides avatars: a person's or assistant's picture, or their initials on a color derived from their name, in a circle.
|
Package avatar provides avatars: a person's or assistant's picture, or their initials on a color derived from their name, in a circle. |
|
badge
Package badge provides badges: small counters or dots, alone or pinned to the corner of another element.
|
Package badge provides badges: small counters or dots, alone or pinned to the corner of another element. |
|
button
Package button provides a stateful clickable button component built on the stateless elements.
|
Package button provides a stateful clickable button component built on the stateless elements. |
|
checkbox
Package checkbox provides a stateful checkbox with an optional label.
|
Package checkbox provides a stateful checkbox with an optional label. |
|
chip
Package chip provides chips: small rounded labels for filters, tags and choices, optionally selectable and removable.
|
Package chip provides chips: small rounded labels for filters, tags and choices, optionally selectable and removable. |
|
copybutton
Package copybutton provides a button that copies text to the clipboard and briefly confirms it with a check mark.
|
Package copybutton provides a button that copies text to the clipboard and briefly confirms it with a check mark. |
|
dialog
Package dialog provides a stateful centered modal dialog.
|
Package dialog provides a stateful centered modal dialog. |
|
drawer
Package drawer provides a stateful slide-out side panel.
|
Package drawer provides a stateful slide-out side panel. |
|
dropdown
Package dropdown provides a stateful dropdown.
|
Package dropdown provides a stateful dropdown. |
|
icon
Package icon renders icons you bring: Giode ships no icon set, so an app only carries the icons it actually uses, under whatever license it picked them.
|
Package icon renders icons you bring: Giode ships no icon set, so an app only carries the icons it actually uses, under whatever license it picked them. |
|
imageutil
Package imageutil renders plain images with fit modes.
|
Package imageutil renders plain images with fit modes. |
|
kit
Package kit provides the small building blocks used to create custom components: color state shading, hover tracking and overlay positioning (used by elements.RegisterPortal to keep click/hover popups inside the window).
|
Package kit provides the small building blocks used to create custom components: color state shading, hover tracking and overlay positioning (used by elements.RegisterPortal to keep click/hover popups inside the window). |
|
licenses
Package licenses shows the open-source licenses of the modules an app is built from: the notices screen app stores and licenses ask for.
|
Package licenses shows the open-source licenses of the modules an app is built from: the notices screen app stores and licenses ask for. |
|
pagination
Package pagination provides a stateful page-number control built on Button.
|
Package pagination provides a stateful page-number control built on Button. |
|
progress
Package progress provides a determinate progress bar.
|
Package progress provides a determinate progress bar. |
|
slider
Package slider provides a stateful horizontal slider.
|
Package slider provides a stateful horizontal slider. |
|
spinner
Package spinner provides an indeterminate circular loading indicator.
|
Package spinner provides an indeterminate circular loading indicator. |
|
tabs
Package tabs provides a stateful tab bar with per-tab views.
|
Package tabs provides a stateful tab bar with per-tab views. |
|
title
Package title provides heading text.
|
Package title provides heading text. |
|
toggle
Package toggle provides an on/off switch with an animated knob, the standard settings control on iOS and Android.
|
Package toggle provides an on/off switch with an animated knob, the standard settings control on iOS and Android. |
|
Package crash records the app's crashes and hands them back on the next start, to show the user or send to you.
|
Package crash records the app's crashes and hands them back on the next start, to show the user or send to you. |
|
Package elements provides the stateless building blocks of Giode: box, flex, text and raw.
|
Package elements provides the stateless building blocks of Giode: box, flex, text and raw. |
|
internal/base
Package base provides the shared runtime every element package is built on: the Element interface, the frame and color helpers, the absolute-position, portal, semantic and Back/OnKey registries, and the keyed and memo caches.
|
Package base provides the shared runtime every element package is built on: the Element interface, the frame and color helpers, the absolute-position, portal, semantic and Back/OnKey registries, and the keyed and memo caches. |
|
examples
|
|
|
custom
command
Command custom demonstrates creating a custom component with the component kit: a clickable star rating built on the stateless elements, Gio's clickable and the kit helpers.
|
Command custom demonstrates creating a custom component with the component kit: a clickable star rating built on the stateless elements, Gio's clickable and the kit helpers. |
|
hello
command
Command hello is a minimal Giode demo: a frameless, draggable window with a counter button and a global right-click menu.
|
Command hello is a minimal Giode demo: a frameless, draggable window with a counter button and a global right-click menu. |
|
mcp
command
Command mcp is a small todo app exposed to AI agents through Giode's built-in MCP server: one option turns it on, and one call adds a custom tool next to the built-in ones (ui_snapshot, ui_click, ui_type, ui_set_value, screenshot, state_list, state_set, ...).
|
Command mcp is a small todo app exposed to AI agents through Giode's built-in MCP server: one option turns it on, and one call adds a custom tool next to the built-in ones (ui_snapshot, ui_click, ui_type, ui_set_value, screenshot, state_list, state_set, ...). |
|
scanner
command
Command scanner is a small document scanner built on Giode's camera, OCR, printing and biometric packages.
|
Command scanner is a small document scanner built on Giode's camera, OCR, printing and biometric packages. |
|
showcase
command
|
|
|
titlebar
command
Command titlebar shows a frameless window with Giode's custom title bar: drag it to move the window, double-click it to maximize, use the File menu, and switch between the Windows and Mac looks.
|
Command titlebar shows a frameless window with Giode's custom title bar: drag it to move the window, double-click it to maximize, use the File menu, and switch between the Windows and Mac looks. |
|
tour
command
Command tour is a small task list: a sidebar, a progress card, a text field and checkable rows, styled with CSS-like properties and following the light or dark theme.
|
Command tour is a small task list: a sidebar, a progress card, a text field and checkable rows, styled with CSS-like properties and following the light or dark theme. |
|
transitions
command
Command transitions shows every built-in transition kind, with the speed and easing chosen from the toolbar.
|
Command transitions shows every built-in transition kind, with the speed and easing chosen from the toolbar. |
|
workbench
command
Command workbench exercises the interactive building blocks together: browse folders in a lazily loaded TreeView, drop files onto the window to list them in a VirtualList, click rows (Pressable, Keyed state), copy a path (clipboard), and get notified with toasts.
|
Command workbench exercises the interactive building blocks together: browse folders in a lazily loaded TreeView, drop files onto the window to list them in a VirtualList, click rows (Pressable, Keyed state), copy a path (clipboard), and get notified with toasts. |
|
Package fonts holds the text shaper shared by all Giode elements.
|
Package fonts holds the text shaper shared by all Giode elements. |
|
Package host has the platform services of giode.App that don't need its window, for apps that host Giode themselves - in a GLFW window, as an embedded view (see docs/low-level.md): keeping the screen on, the single-instance lock, and the clipboard bridge between Gio's input router and the host's clipboard.
|
Package host has the platform services of giode.App that don't need its window, for apps that host Giode themselves - in a GLFW window, as an embedded view (see docs/low-level.md): keeping the screen on, the single-instance lock, and the clipboard bridge between Gio's input router and the host's clipboard. |
|
Package i18n translates an app's text and tells its layout which way to read: messages by locale with plurals and placeholders, the system's locale, and right-to-left languages.
|
Package i18n translates an app's text and tells its layout which way to read: messages by locale with plurals and placeholders, the system's locale, and right-to-left languages. |
|
internal
|
|
|
bridge
Package bridge helps giode's platform packages (push, store, review) call into Java and Objective-C: asynchronous requests answered by a callback with an id, and, on Android, static Java calls.
|
Package bridge helps giode's platform packages (push, store, review) call into Java and Objective-C: asynchronous requests answered by a callback with an id, and, on Android, static Java calls. |
|
cmd/reexport
command
Command reexport writes the root giode package's reexport.go: an alias for every exported name of package ui, so `giode.Box` and `ui.Box` are the same thing and a custom host can import ui without the root package's App (and gioui.org/app).
|
Command reexport writes the root giode package's reexport.go: an alias for every exported name of package ui, so `giode.Box` and `ui.Box` are the same thing and a custom host can import ui without the root package's App (and gioui.org/app). |
|
cmd/skilldocs
command
Command skilldocs copies the documentation (docs/, without the contributor-only pages) into the agent skill's references folder, skills/giode/references, so the skill carries the docs wherever it's installed.
|
Command skilldocs copies the documentation (docs/, without the contributor-only pages) into the agent skill's references folder, skills/giode/references, so the skill carries the docs wherever it's installed. |
|
mobile
Package mobile reaches the Android services Gio doesn't expose - the system share sheet and the activity lifecycle - through a small Java helper (mobile_android.java, shipped as mobile_android.jar, which gogio packs into the APK).
|
Package mobile reaches the Android services Gio doesn't expose - the system share sheet and the activity lifecycle - through a small Java helper (mobile_android.java, shipped as mobile_android.jar, which gogio packs into the APK). |
|
raster
Package raster rasterizes vector shapes - icons, glyphs - into images on the CPU, once, so they're drawn as cached textures instead of paths the GPU renderer rasterizes again every frame.
|
Package raster rasterizes vector shapes - icons, glyphs - into images on the CPU, once, so they're drawn as cached textures instead of paths the GPU renderer rasterizes again every frame. |
|
textrender
Package textrender lays out and draws text for giode's text elements.
|
Package textrender lays out and draws text for giode's text elements. |
|
Package mcp is a small, dependency-free Model Context Protocol server: tools described by Go functions, served over Streamable HTTP or stdio.
|
Package mcp is a small, dependency-free Model Context Protocol server: tools described by Go functions, served over Streamable HTTP or stdio. |
|
Package multicast lets an Android app receive multicast and broadcast packets: LAN discovery (mDNS, SSDP, LocalSend's multicast announcements) that Android otherwise filters out on Wi-Fi to save battery.
|
Package multicast lets an Android app receive multicast and broadcast packets: LAN discovery (mDNS, SSDP, LocalSend's multicast announcements) that Android otherwise filters out on Wi-Fi to save battery. |
|
Package ocr recognises text in images on the device: no network, no account.
|
Package ocr recognises text in images on the device: no network, no account. |
|
Package printing prints documents through the system's print dialog:
|
Package printing prints documents through the system's print dialog: |
|
Package push receives remote push notifications: Firebase Cloud Messaging (FCM) on Android, the Apple Push Notification service (APNs) on iOS and macOS.
|
Package push receives remote push notifications: Firebase Cloud Messaging (FCM) on Android, the Apple Push Notification service (APNs) on iOS and macOS. |
|
Package review asks the user to rate the app without leaving it: Google Play's in-app review on Android, the App Store's rating prompt on iOS and macOS.
|
Package review asks the user to rate the app without leaving it: Google Play's in-app review on Android, the App Store's rating prompt on iOS and macOS. |
|
Package router provides a simple navigation layer: define views as routes, navigate between them with Push/Navigate/Back and link to them with Link.
|
Package router provides a simple navigation layer: define views as routes, navigate between them with Push/Navigate/Back and link to them with Link. |
|
Package shortcut parses keyboard shortcuts written as text ("Mod+T", "Ctrl+Shift+P", "F5", "Mod+,"), matches them against key events and formats them for display the way each platform writes them.
|
Package shortcut parses keyboard shortcuts written as text ("Mod+T", "Ctrl+Shift+P", "F5", "Mod+,"), matches them against key events and formats them for display the way each platform writes them. |
|
Package state provides a minimal global-state primitive: an observable value that can be read and written from anywhere - not just from within a Layout call, but a goroutine outside the render loop too (a network response, a timer) - and requests a redraw when it changes.
|
Package state provides a minimal global-state primitive: an observable value that can be read and written from anywhere - not just from within a Layout call, but a goroutine outside the render loop too (a network response, a timer) - and requests a redraw when it changes. |
|
Package store sells in-app products and subscriptions: Google Play Billing on Android, the App Store (StoreKit) on iOS and macOS.
|
Package store sells in-app products and subscriptions: Google Play Billing on Android, the App Store (StoreKit) on iOS and macOS. |
|
Package support lets the app's users report a problem and support its development.
|
Package support lets the app's users report a problem and support its development. |
|
Package update keeps a desktop app up to date from a feed you host: it checks for a newer version, downloads it, verifies it, replaces the app and restarts it.
|
Package update keeps a desktop app up to date from a feed you host: it checks for a newer version, downloads it, verifies it, replaces the app and restarts it. |
|
web
|
|
|
snippets/home
command
|
|
|
snippets/recipes
command
|