desktop

package
v0.0.0-...-58b9e34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package desktop opens native windows, panels and menus from PureKit desktop apps.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnavailable means the current platform has no implementation of the native control.
	ErrUnavailable = errors.New("native control is unavailable on this platform")
	// ErrNotReady means the MyGo app has not entered its event loop.
	ErrNotReady = errors.New("the desktop app is not ready")
	// ErrWindow means the action needs an open parent window.
	ErrWindow = errors.New("an open parent window is required")
)

Functions

func SaveFile

func SaveFile(p mygo.SaveDialogOptions) (string, error)

SaveFile asks the system for a save location. It returns an empty path on cancellation and leaves writing the file to the caller.

func ShowFontPanel

func ShowFontPanel(_ FontPanelProps) error

ShowFontPanel opens the system font panel on macOS.

func ShowPanel

func ShowPanel(p WindowProps, content func(*ui.Context)) (*mygo.Window, error)

ShowPanel opens an independent floating panel with PureKit content.

func ShowQuickLook

func ShowQuickLook(_ *mygo.Window, _ []string) error

ShowQuickLook previews local files through Quick Look on macOS.

func ShowShare

func ShowShare(_ *mygo.Window, _ ShareProps) error

ShowShare opens the system share picker on macOS.

func ShowSheet

func ShowSheet(parent *mygo.Window, p WindowProps, content func(*ui.Context)) (*mygo.Window, error)

ShowSheet opens a native child window that blocks input to its parent until it closes. On macOS this is a window-attached sheet.

func SupportsMacPanels

func SupportsMacPanels() bool

SupportsMacPanels reports whether the caller can use the AppKit-only panels.

Types

type Font

type Font struct {
	// Name is the PostScript font name. Family is the user-facing family name.
	Name, Family string
	// Size is the font size in points.
	Size float64
}

Font describes a typeface selected in the system font panel.

type FontPanelProps

type FontPanelProps struct {
	// Font is the initial selection. A zero Font uses the system font.
	Font Font
	// OnChange receives choices from the system font panel on the app's UI thread.
	OnChange func(Font)
}

type ShareProps

type ShareProps struct {
	// Anchor is a rectangle in the parent window's content coordinates.
	Anchor ui.Rect
	// Text and Files are offered to the system's sharing services.
	Text  string
	Files []string
}

type StatusItem

type StatusItem struct {
	Tray *mygo.Tray
	// contains filtered or unexported fields
}

StatusItem is an app menu bar item on macOS, or an icon in the notification area elsewhere.

func NewStatusItem

func NewStatusItem(p StatusItemProps) (*StatusItem, error)

NewStatusItem creates a status item whose menu uses the app's shared commands.

func (*StatusItem) Refresh

func (item *StatusItem) Refresh()

Refresh updates the availability and checked state of the status item's commands.

type StatusItemProps

type StatusItemProps struct {
	// ID identifies the item across launches.
	ID string
	// Title and Tooltip describe the item to the system.
	Title, Tooltip string
	// IconPNG is the icon image. On macOS a template icon follows the menu bar appearance.
	IconPNG        []byte
	IconIsTemplate bool
	// Commands are the actions shown in the item's menu.
	Commands []command.Command
}

type WindowProps

type WindowProps struct {
	// Title is the window's title.
	Title string
	// Width and Height are the size in DIPs, defaulting to 460 by 340.
	Width, Height int
	// Theme is the theme configuration for the content. Nil uses PureKit's defaults.
	Theme *theme.Config
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL