detect

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InMultiplexer

func InMultiplexer() bool

InMultiplexer returns true if running inside any terminal multiplexer.

func InScreen

func InScreen() bool

InScreen returns true if running inside GNU Screen.

func InTmux

func InTmux() bool

InTmux returns true if running inside tmux.

func SupportsProgress added in v0.1.6

func SupportsProgress(terminal Terminal) bool

SupportsProgress returns true if the terminal supports OSC 9;4 progress bars. Supported by: Windows Terminal, Ghostty (1.2+), iTerm2 (3.6.6+), ConEmu, Mintty

func TmuxAllowPassthrough added in v0.1.1

func TmuxAllowPassthrough() string

TmuxAllowPassthrough checks if tmux allow-passthrough is enabled. Returns: "on", "off", "all", or empty string if unknown.

func TmuxSupportsPassthrough added in v0.1.1

func TmuxSupportsPassthrough() bool

TmuxSupportsPassthrough returns true if tmux version is 3.2 or higher.

func TmuxVersion added in v0.1.1

func TmuxVersion() string

TmuxVersion returns the tmux version string, or empty if not available.

Types

type Capabilities

type Capabilities struct {
	Terminal         Terminal `json:"terminal"`
	Protocol         Protocol `json:"protocol"`
	SupportsTitle    bool     `json:"supports_title"`
	SupportsUrgency  bool     `json:"supports_urgency"`
	SupportsID       bool     `json:"supports_id"`
	SupportsProgress bool     `json:"supports_progress"`
	InMultiplexer    bool     `json:"in_multiplexer"`
	NativeAvailable  bool     `json:"native_available"`
}

Capabilities describes terminal notification capabilities.

func GetCapabilities

func GetCapabilities(nativeAvailable bool) Capabilities

GetCapabilities returns the notification capabilities for the current environment.

type Protocol

type Protocol string

Protocol represents an OSC notification protocol.

const (
	ProtocolOSC9   Protocol = "osc9"   // iTerm2 style - message only
	ProtocolOSC777 Protocol = "osc777" // rxvt/WezTerm/Ghostty - title + body
	ProtocolOSC99  Protocol = "osc99"  // Kitty - full featured (urgency, IDs)
	ProtocolNone   Protocol = ""
)

func SelectProtocol

func SelectProtocol(terminal Terminal) Protocol

SelectProtocol returns the best OSC protocol for a terminal.

type Terminal

type Terminal string

Terminal represents a detected terminal emulator.

const (
	TerminalKitty           Terminal = "kitty"
	TerminalITerm2          Terminal = "iterm2"
	TerminalWezTerm         Terminal = "wezterm"
	TerminalGhostty         Terminal = "ghostty"
	TerminalVTE             Terminal = "vte"
	TerminalFoot            Terminal = "foot"
	TerminalAlacritty       Terminal = "alacritty"
	TerminalKonsole         Terminal = "konsole"
	TerminalAppleTerminal   Terminal = "apple-terminal"
	TerminalWindowsTerminal Terminal = "windows-terminal"
	TerminalVSCode          Terminal = "vscode"
	TerminalHyper           Terminal = "hyper"
	TerminalUnknown         Terminal = ""
)

func DetectTerminal

func DetectTerminal() Terminal

DetectTerminal detects the current terminal emulator from environment variables.

Jump to

Keyboard shortcuts

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