Documentation
¶
Overview ¶
Package source provides the two concrete shell.AppSource implementations that feed the desktop shell: the native xdgSource (source_xdg.go, !js), which scans a real XDG filesystem, and the embeddedSource (this file), which serves a curated app set, icon set and virtual file listing from an embed.FS. The embedded source is what makes the shell portable to the browser (js/wasm), where no real filesystem exists — the same shell/render composition renders a real, populated desktop with data baked into the binary.
Index ¶
- type Embedded
- type XDG
- func (x *XDG) Apps() *shell.AppIndex
- func (x *XDG) Dir() *shell.Dir
- func (x *XDG) IconBytes(name string) ([]byte, bool)
- func (x *XDG) Menu() *shell.MenuModel
- func (x *XDG) Resolve(name string, content []byte) shell.OpenWith
- func (x *XDG) Resolver() *shell.Resolver
- func (x *XDG) ThumbKey(it shell.FileItem) string
- type XDGOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Embedded ¶
type Embedded struct {
// contains filtered or unexported fields
}
Embedded is the browser-facing shell.AppSource: a curated set of desktop entries, an application menu, a small virtual directory and the icons for all of them, served from an embed.FS with no filesystem access. It renders the identical shell/render composition the native xdgSource does.
func NewEmbedded ¶
func NewEmbedded() *Embedded
NewEmbedded builds the curated, filesystem-free shell.AppSource.
func (*Embedded) IconBytes ¶
IconBytes resolves an icon name (or a "thumb-*" key) to its embedded PNG bytes, falling back through the mime name to a generic icon so a cell always gets a real image rather than a placeholder when a specific icon is absent.
type XDG ¶
type XDG struct {
// contains filtered or unexported fields
}
XDG is the native shell.AppSource: it scans a real XDG filesystem exactly as the shell always has — desktopentry.Scan for the app index, menu.Load for the categorized menu, mime + mimeapps for "open with", go-thumbnail for thumbnails and an icontheme.Theme for icons — and exposes it through the portable AppSource seam so the identical shell/render composition runs on a real Linux desktop and in the browser alike.
func NewXDG ¶
func NewXDG(o XDGOptions) *XDG
NewXDG scans the filesystem and builds the native source. It never fails: a missing MIME database, unreadable menu or unreadable directory each degrade to an empty-but-valid model, exactly as the shell's original buildScene did.
func (*XDG) IconBytes ¶
IconBytes resolves an icon name (or absolute path) to its encoded file bytes through the icon theme, and ok=false when it cannot be found or read.
type XDGOptions ¶
type XDGOptions struct {
// Dir is the directory shown in the file grid (empty -> the user home,
// then the working directory, then the filesystem root).
Dir string
// IconTheme is the icon-theme name (empty -> hicolor).
IconTheme string
// IconSize is the nominal icon size requested from the theme (0 ->
// render.DefaultIconSize's 48).
IconSize int
}
XDGOptions parametrises the native filesystem scan.