Documentation
¶
Overview ¶
Package render turns the shell package's composition/model values into a live go-widgets widget tree and captures it to an image. It is the raw rendering layer: it imports the toolkit, the icon theme and the notification toast bridge, so it is exercised by the runtime smoke rather than the model coverage gate.
Index ¶
- Constants
- type Config
- type IconLoader
- type Scene
- func (s *Scene) AppCount() int
- func (s *Scene) DockCount() int
- func (s *Scene) FileCount() int
- func (s *Scene) MenuCategoryCount() int
- func (s *Scene) Render() (*image.RGBA, error)
- func (s *Scene) Root() toolkit.Widget
- func (s *Scene) SetQuery(q string)
- func (s *Scene) SetToasts(ts []*toolkit.Toast)
- func (s *Scene) ShowToast(t *toolkit.Toast)
- func (s *Scene) Theme() *toolkit.Theme
- func (s *Scene) ToastCount() int
- func (s *Scene) Widget() toolkit.Widget
Constants ¶
const DefaultIconSize = 48
DefaultIconSize is the nominal pixel size requested from the icon theme.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Apps *shell.AppIndex
Menu *shell.MenuModel
Dir *shell.Dir
Thumbnailer *shell.Thumbnailer
Icons *IconLoader
Theme *toolkit.Theme
Width int
Height int
// DockMax caps how many app icons appear in the dock (0 -> a sane default).
DockMax int
}
Config bundles the shell models and rendering resources a Scene composes.
type IconLoader ¶
type IconLoader struct {
// contains filtered or unexported fields
}
IconLoader resolves icon names (or absolute paths) to go-widgets Image widgets through an XDG icon theme, rasterizing PNG/JPEG/GIF icons and falling back to a solid placeholder when an icon is missing or cannot be decoded (e.g. an SVG-only icon). Results are cached per name.
func NewIconLoader ¶
func NewIconLoader(themeName string, size int) *IconLoader
NewIconLoader builds a loader for the named icon theme (defaulting to hicolor) at the given nominal size.
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
Scene is the composed desktop shell: a Border(menubar / dock / launcher / file-grid) plus a floating toast stack. All mutable state (the launcher search query and its results, the file model) flows through go-widgets/mvvm.
func (*Scene) AppCount ¶
AppCount is the number of launchable apps currently listed in the launcher.
func (*Scene) MenuCategoryCount ¶
MenuCategoryCount is the number of application-menu categories.
func (*Scene) Render ¶
Render paints the whole shell (root widget then the toast stack) into a fresh image of the configured size.
func (*Scene) SetQuery ¶
SetQuery updates the launcher search query, driving the results + launcher.
func (*Scene) SetToasts ¶
SetToasts replaces the floating toast stack (e.g. from a notification daemon).
func (*Scene) ShowToast ¶
ShowToast adds a toast to the floating stack (used to present notifications).
func (*Scene) Theme ¶
Theme returns the theme the scene paints with, so a windowing backend paints its background and widgets with the same palette the -capture path uses.
func (*Scene) ToastCount ¶
ToastCount is the number of visible toasts.
func (*Scene) Widget ¶
Widget returns the whole shell — the Border root plus its floating toast overlay — as a single toolkit.Widget. A windowing backend such as github.com/go-widgets/window drives exactly one root widget through its Run loop, so wrapping the overlay here lets the live window show the same composition (dock, launcher, menu, file grid AND notification toasts) that Render paints to a PNG. It is backend-agnostic: it only touches toolkit primitives and reads the scene's live toast slice at Draw time, so a toast pushed by the notifications daemon appears on the next repaint.