osc

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrgencyLow      = 0
	UrgencyNormal   = 1
	UrgencyCritical = 2
)

Urgency levels for OSC 99 notifications.

View Source
const (
	ProgressHidden        = 0 // Remove progress indicator
	ProgressNormal        = 1 // Normal/green progress
	ProgressError         = 2 // Error/red progress
	ProgressIndeterminate = 3 // Indeterminate/pulsing
	ProgressPaused        = 4 // Paused/yellow progress
)

Progress states for OSC 9;4

Variables

This section is empty.

Functions

func BuildITermRequestAttention added in v0.1.1

func BuildITermRequestAttention(fireworks bool) string

BuildITermRequestAttention builds an iTerm2 OSC 1337 RequestAttention sequence. This bounces the dock icon on macOS to get the user's attention. fireworks: if true, shows a brief fireworks animation.

func BuildITermStealFocus added in v0.1.1

func BuildITermStealFocus() string

BuildITermStealFocus builds an iTerm2 OSC 1337 StealFocus sequence. This brings the iTerm2 window to the front.

func BuildOSC8Hyperlink(url, text string) string

BuildOSC8Hyperlink wraps text in an OSC 8 hyperlink sequence. Format: ESC ] 8 ; params ; URI ST text ESC ] 8 ; ; ST Supported by most modern terminals: iTerm2, VTE, kitty, WezTerm, Windows Terminal, etc.

func BuildOSC8HyperlinkWithID added in v0.1.1

func BuildOSC8HyperlinkWithID(url, text, id string) string

BuildOSC8HyperlinkWithID wraps text in an OSC 8 hyperlink with an ID parameter. The ID allows grouping multiple hyperlinks that should be treated as one.

func BuildOSC9

func BuildOSC9(message string) string

BuildOSC9 builds an OSC 9 notification sequence (iTerm2 style, message only). Format: ESC ] 9 ; message BEL

func BuildOSC9Progress added in v0.1.1

func BuildOSC9Progress(state, progress int) string

BuildOSC9Progress builds an OSC 9;4 progress sequence. Format: ESC ] 9 ; 4 ; state ; progress BEL Supported by Windows Terminal, Ghostty, ConEmu, Mintty.

func BuildOSC9ProgressClear added in v0.1.1

func BuildOSC9ProgressClear() string

BuildOSC9ProgressClear builds an OSC 9;4 sequence to clear progress.

func BuildOSC99

func BuildOSC99(message, title string, urgency int, id string) string

BuildOSC99 builds an OSC 99 notification sequence (Kitty style, full-featured). Format: ESC ] 99 ; metadata ; payload ST For simple notifications: ESC ] 99 ; ; message ST For title + body: uses d=0/1 for done flag and p=title/body

func BuildOSC99Close

func BuildOSC99Close(id string) string

BuildOSC99Close builds an OSC 99 close notification sequence. Format: ESC ] 99 ; i=<id>:p=close ; ST

func BuildOSC133CommandExecuted added in v0.1.1

func BuildOSC133CommandExecuted() string

BuildOSC133CommandExecuted marks the start of command execution. Format: OSC 133 ; C ST

func BuildOSC133CommandFinished added in v0.1.1

func BuildOSC133CommandFinished(exitCode int) string

BuildOSC133CommandFinished marks the end of command execution. Format: OSC 133 ; D ; exitcode ST

func BuildOSC133CommandStart added in v0.1.1

func BuildOSC133CommandStart() string

BuildOSC133CommandStart marks the end of prompt/start of user input. Format: OSC 133 ; B ST

func BuildOSC133PromptStart added in v0.1.1

func BuildOSC133PromptStart() string

BuildOSC133PromptStart marks the beginning of a shell prompt. Format: OSC 133 ; A ST

func BuildOSC777

func BuildOSC777(message, title string) string

BuildOSC777 builds an OSC 777 notification sequence (rxvt-unicode style). Format: ESC ] 777 ; notify ; title ; body BEL

func Sanitize

func Sanitize(s string) string

Sanitize removes control characters and semicolons from a string. Semicolons are replaced with colons to avoid breaking OSC 777 parsing.

func SanitizeID

func SanitizeID(id string) string

SanitizeID sanitizes a notification ID for OSC 99. IDs must only contain [a-zA-Z0-9_-+.] characters.

func WrapForMultiplexer

func WrapForMultiplexer(sequence string) string

WrapForMultiplexer wraps an OSC sequence for multiplexer passthrough if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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