macos

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 41 Imported by: 0 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

Rendered for darwin/amd64

Overview

Package macos is NSGo's AppKit backend: one flipped, layer-backed NSView per node, styled through its CALayer, with text the engine laid out with CoreText drawn on the main thread and images decoded off it, and an optional NSVisualEffectView material behind the window's content. Alerts are sheets of visible windows or standalone modal dialogs; Escape, Cmd-[, Option-Left and the mouse's back button go back. It calls AppKit through purego, so it builds without cgo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(app engine.App, opts Options)

Run runs app and the event loop until the app ends, by its shutdown mode or by quitting. The app opens its windows, panels and tray icons itself (core.RootOptions.Windows); opts' size, title and material are its main window's. Call it from main. It returns once the app's graph is gone and its storage written, leaving the process to the caller, as NSH's run_app does.

Types

type Options

type Options struct {
	Title         string
	Width, Height driver.Points
	// Hidden opens the main window without showing it (nsgo.StartHidden).
	Hidden bool
	// ID names the app's directories and storage (engine.AppDirs).
	ID string
	// Updates is the build's update channel and defaults.
	Updates updates.Config
	// Components are the native components Native elements name.
	Components driver.NativeComponents
	// Material is the material behind the app's views, where they draw
	// nothing opaque (nsgo.WindowMaterial).
	Material driver.WindowMaterial
	// Transparent, NoShadow and SkipTaskbar are the main window's (nsgo.WindowTransparent, nsgo.WindowNoShadow, nsgo.SkipTaskbar).
	Transparent, NoShadow, SkipTaskbar bool
	// Frame is where the main window opens (nsgo.WindowFrame).
	Frame driver.WindowFrame
	// Constraints limit the main window (nsgo.WindowConstraints).
	Constraints driver.WindowConstraints
	// Perf shows the performance monitor over the app: frame rate, frame
	// and commit costs, CPU, GPU and memory.
	Perf bool
	// Fonts are font files under the app's resources, registered before
	// the first view.
	Fonts []string
	// Appearance is the appearance the app starts in.
	Appearance driver.Appearance
	// HideDock starts the app out of the Dock and the app switcher, as a
	// tray app (nsgo.HideDock); desktop.SetDockVisible changes it.
	HideDock bool
	// LaunchedAtLogin marks a launch by the macOS 11/12 LaunchAgent.
	LaunchedAtLogin bool
	// Host is what an embedding host gives the view (NewView).
	Host engine.HostOptions
}

Options configure the window.

type View

type View struct {
	// contains filtered or unexported fields
}

View is an app in an NSView of an embedding host's window, which the host's own event loop runs (NewView).

func NewView

func NewView(app engine.App, opts Options) *View

NewView makes an NSView showing app, for a host that runs AppKit's loop itself. Its engine starts once the view is in a window, so settings made before that are in the app's first frame. Call it on the main thread; several views may show at once, in one window or several.

func (*View) Close

func (v *View) Close()

Close stops the app and frees the view, which the host removes from its window. Calling it again does nothing.

func (*View) Handle

func (v *View) Handle() uintptr

Handle returns the NSView, which the host adds to its views and sizes.

func (*View) SetHostEnvironment

func (v *View) SetHostEnvironment(env engine.HostEnvironment)

SetHostEnvironment sets what the host sets over the system's environment: its locale, text size and appearance, which AppKit's own chrome in the view takes too.

func (*View) SetTokens

func (v *View) SetTokens(t engine.Tokens)

SetTokens sets the values the host themes the app with.

Jump to

Keyboard shortcuts

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