ui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectOSC99Support

func DetectOSC99Support(seq string) bool

DetectOSC99Support parses an OSC response sequence and returns true if it indicates OSC 99 notification support. This function should be called from the capabilities detection layer to determine terminal support.

func OSC99QuerySequence

func OSC99QuerySequence() string

OSC99QuerySequence returns the OSC 99 query sequence used to detect terminal support. This should be sent during capability detection.

func QueryCmd

func QueryCmd(env uv.Environ) tea.Cmd

QueryCmd returns a tea.Cmd that queries the terminal for different capabilities.

Types

type Application

type Application interface {
	// Context returns the context of the application.
	Context() context.Context
	// Config returns the configuration of the application.
	Config() *config.Config
	// QuweueUpdateDraw adds a function to the queue to be executed in the main thread.
	QueueUpdateDraw(f func())
	Stop()
	Draw()
}

Application ...

type Backend

type Backend interface {
	Send(n Notification) tea.Cmd
}

Backend defines the interface for sending desktop notifications.

type BellBackend

type BellBackend struct{}

BellBackend is a notification backend that triggers the terminal bell character (\x07).

func NewBellBackend

func NewBellBackend() *BellBackend

NewBellBackend creates a new bell notification backend.

func (*BellBackend) Send

func (b *BellBackend) Send(n Notification) tea.Cmd

Send returns a tea.Cmd that triggers the terminal bell character (\x07). The terminal will emit an audible beep or visual flash based on user configuration. No message text is displayed.

type Capabilities

type Capabilities struct {
	// Profile is the terminal color profile used to determine how colors are
	// rendered.
	Profile colorprofile.Profile
	// Columns is the number of character columns in the terminal.
	Columns int
	// Rows is the number of character rows in the terminal.
	Rows int
	// PixelX is the width of the terminal in pixels.
	PixelX int
	// PixelY is the height of the terminal in pixels.
	PixelY int
	// KittyGraphics indicates whether the terminal supports the Kitty graphics
	// protocol.
	KittyGraphics bool
	// SixelGraphics indicates whether the terminal supports Sixel graphics.
	SixelGraphics bool
	// Env is the terminal environment variables.
	Env uv.Environ
	// TerminalVersion is the terminal version string.
	TerminalVersion string
	// ReportFocusEvents indicates whether the terminal supports focus events.
	ReportFocusEvents bool
	// OSC99Notifications indicates whether the terminal supports OSC 99 notifications.
	OSC99Notifications bool
}

Capabilities define different terminal capabilities supported.

func (Capabilities) CellSize

func (c Capabilities) CellSize() (width, height int)

CellSize returns the size of a single terminal cell in pixels.

func (Capabilities) SupportsKittyGraphics

func (c Capabilities) SupportsKittyGraphics() bool

SupportsKittyGraphics returns true if the terminal supports Kitty graphics.

func (Capabilities) SupportsSixelGraphics

func (c Capabilities) SupportsSixelGraphics() bool

SupportsSixelGraphics returns true if the terminal supports Sixel graphics.

func (Capabilities) SupportsTrueColor

func (c Capabilities) SupportsTrueColor() bool

SupportsTrueColor returns true if the terminal supports true color.

func (*Capabilities) Update

func (c *Capabilities) Update(msg any)

Update updates the capabilities based on the given message.

type Model

type Model[T any] interface {
	Update(msg tea.Msg) (T, tea.Cmd)
	View() string
}

Model represents a common interface for UI components.

type Notification

type Notification struct {
	Title   string
	Message string
}

Notification represents a desktop notification request.

type OSCBackend

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

OSCBackend sends desktop notifications using OSC escape sequences. It automatically selects the best available protocol: OSC 99 (modern standard) if supported, falling back to OSC 777 (urxvt extension) otherwise.

func NewOSCBackend

func NewOSCBackend(icon []byte, supports99 bool) *OSCBackend

NewOSCBackend creates a new OSC notification backend with automatic protocol detection. If supports99 is true, it uses OSC 99; otherwise it falls back to OSC 777.

func (*OSCBackend) Send

func (b *OSCBackend) Send(n Notification) tea.Cmd

Send returns a tea.Cmd that writes OSC escape sequences to the terminal. Uses OSC 99 if supported, otherwise OSC 777.

Directories

Path Synopsis
models

Jump to

Keyboard shortcuts

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