notification

package
v1.70.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCmd

func ErrorCmd(text string) tea.Cmd

func InfoCmd

func InfoCmd(text string) tea.Cmd

func SuccessCmd

func SuccessCmd(text string) tea.Cmd

func WarningCmd

func WarningCmd(text string) tea.Cmd

Types

type AutoHideMsg added in v1.70.1

type AutoHideMsg struct {
	ID         uint64
	Generation uint64
}

AutoHideMsg is sent by a notification timer. The generation field prevents stale timers from hiding notifications after hover pause/restart.

type DismissMsg added in v1.70.1

type DismissMsg struct {
	ID uint64
}

DismissMsg is sent when the user explicitly dismisses a notification.

type HideMsg

type HideMsg struct {
	ID uint64 // If 0, hides all notifications (backward compatibility)
}

type Manager

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

Manager represents a notification manager that displays multiple stacked messages in the bottom right corner of the screen.

func New

func New() Manager

func (*Manager) BodyHit added in v1.70.1

func (n *Manager) BodyHit(x, y int) (uint64, string, bool)

BodyHit checks whether the coordinates hit the body of a notification and returns its ID and text. The close button is excluded so dismiss priority can stay separate from click-to-copy behavior.

func (*Manager) CloseButtonHit added in v1.70.1

func (n *Manager) CloseButtonHit(x, y int) (uint64, bool)

CloseButtonHit checks if the given screen coordinates hit a notification close glyph.

func (*Manager) CopyHit added in v1.70.1

func (n *Manager) CopyHit(x, y int) (uint64, string, bool)

CopyHit checks whether the coordinates hit the currently-hovered notification body and returns its ID and text. The close button is excluded so dismiss priority stays separate from click-to-copy behavior.

func (*Manager) GetLayer

func (n *Manager) GetLayer() *lipgloss.Layer

func (*Manager) HandleClick added in v1.41.0

func (n *Manager) HandleClick(x, y int) tea.Cmd

HandleClick checks if the given screen coordinates hit a notification close button and returns a dismiss command when they do. Body clicks do not dismiss; callers can use CopyHit for additional behavior such as click-to-copy.

func (*Manager) HandleMouseMotion added in v1.70.1

func (n *Manager) HandleMouseMotion(x, y int) (Manager, tea.Cmd)

HandleMouseMotion updates hover state. Entering an auto-hide notification invalidates its pending timer; leaving restarts a generation-safe timer.

func (*Manager) MarkCopied added in v1.70.1

func (n *Manager) MarkCopied(id uint64) Manager

MarkCopied records that the given notification was copied so View can show a transient copied label. The state is cleared when hover moves away or the item is removed.

func (*Manager) Open

func (n *Manager) Open() bool

func (*Manager) SetSize

func (n *Manager) SetSize(width, height int)

SetSize records the screen size used to position notifications.

func (*Manager) Update

func (n *Manager) Update(msg tea.Msg) (Manager, tea.Cmd)

func (*Manager) View

func (n *Manager) View() string

type ShowMsg

type ShowMsg struct {
	Text string
	Type Type // Defaults to TypeSuccess for backward compatibility
}

type Type

type Type int

Type represents the type of notification

const (
	TypeSuccess Type = iota
	TypeWarning
	TypeInfo
	TypeError
)

Jump to

Keyboard shortcuts

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