client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeSessionID

func NormalizeSessionID(sessionID string) string

NormalizeSessionID extracts the UUID part from ITERM_SESSION_ID format Handles both "w0t1p12:UUID" and "UUID" formats, returns just the UUID This ensures compatibility with both ITERM_SESSION_ID environment variable format and direct UUID usage throughout the it2 CLI.

func NotificationEventTypes

func NotificationEventTypes() []string

NotificationEventTypes returns all supported notification event types that use the session parameter

func NotificationEventTypesAll

func NotificationEventTypesAll() []string

NotificationEventTypesAll returns all notification event types

func NotificationEventTypesGlobal

func NotificationEventTypesGlobal() []string

NotificationEventTypesGlobal returns notification types that ignore the session parameter

func NotificationTypeFromString

func NotificationTypeFromString(event string) (pb.NotificationType, error)

NotificationTypeFromString converts a string to a NotificationType enum value

func NotificationTypeToString

func NotificationTypeToString(notifType pb.NotificationType) string

NotificationTypeToString converts a NotificationType enum value to a string

Types

type BroadcastDomain

type BroadcastDomain struct {
	SessionIds []string `json:"session_ids"`
}

BroadcastDomain represents a broadcast domain containing session IDs

type Client

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

Client manages a WebSocket connection to the iTerm2 API.

func New

func New(wsURL string) *Client

func (*Client) ActivateSession

func (c *Client) ActivateSession(ctx context.Context, sessionID string, selectSession bool) (*pb.ActivateResponse, error)

ActivateSession activates and optionally selects a session with default options

func (*Client) ActivateSessionWithOptions

func (c *Client) ActivateSessionWithOptions(ctx context.Context, sessionID string, selectSession, orderWindowFront, selectTab bool) (*pb.ActivateResponse, error)

ActivateSessionWithOptions activates a session with full control over activation behavior

func (*Client) ActivateTab

func (c *Client) ActivateTab(ctx context.Context, tabID string, selectTab bool) (*pb.ActivateResponse, error)

ActivateTab activates and optionally selects a tab

func (*Client) ActivateWindow

func (c *Client) ActivateWindow(ctx context.Context, windowID string, orderFront bool) (*pb.ActivateResponse, error)

ActivateWindow activates and optionally brings a window to the front

func (*Client) ApplyColorPreset

func (c *Client) ApplyColorPreset(ctx context.Context, presetName, profileName string) error

ApplyColorPreset applies a color preset to a specific profile

func (*Client) BindKey

func (c *Client) BindKey(ctx context.Context, key, action, profile string, global bool, description string) error

BindKey creates or updates a keyboard binding

func (*Client) ClearBuffer

func (c *Client) ClearBuffer(ctx context.Context, sessionID string, scrollback, screenOnly bool) error

ClearBuffer clears the screen buffer and/or scrollback history

func (*Client) ClearHighlights

func (c *Client) ClearHighlights(ctx context.Context, sessionID string) error

ClearHighlights removes all text highlights

func (*Client) ClearSelection

func (c *Client) ClearSelection(ctx context.Context, sessionID string) error

ClearSelection clears the current text selection for a session

func (*Client) ClearSessionBadge

func (c *Client) ClearSessionBadge(ctx context.Context, sessionID string) error

ClearSessionBadge clears the session badge by setting it to empty string

func (*Client) ClearTabColor

func (c *Client) ClearTabColor(ctx context.Context, tabID string) error

ClearTabColor clears the tab color by deleting the session-specific overrides

func (*Client) ClearTabTitle

func (c *Client) ClearTabTitle(ctx context.Context, tabID string) error

ClearTabTitle clears the tab title by deleting the user.title variable

func (*Client) ClearWindowTitle

func (c *Client) ClearWindowTitle(ctx context.Context, windowID string) error

ClearWindowTitle clears the window title by deleting the user.title variable

func (*Client) Close

func (c *Client) Close() error

func (*Client) CloseSessions

func (c *Client) CloseSessions(ctx context.Context, sessionIDs []string, force bool) (*pb.CloseResponse, error)

CloseSessions closes one or more sessions

func (*Client) CloseTabs

func (c *Client) CloseTabs(ctx context.Context, tabIDs []string, force bool) (*pb.CloseResponse, error)

CloseTabs closes one or more tabs

func (*Client) CloseWindows

func (c *Client) CloseWindows(ctx context.Context, windowIDs []string, force bool) (*pb.CloseResponse, error)

CloseWindows closes one or more windows

func (*Client) ConfirmAlert

func (c *Client) ConfirmAlert(ctx context.Context, message, title string) (interface{}, error)

ConfirmAlert displays a confirmation alert

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

func (*Client) CopySelection

func (c *Client) CopySelection(ctx context.Context, sessionID string) error

CopySelection copies the current selection to clipboard

func (*Client) CreateTabWithOptions

func (c *Client) CreateTabWithOptions(ctx context.Context, profileName, windowID string, tabIndex uint32, command string) (*pb.CreateTabResponse, error)

CreateTabWithOptions creates a new tab with advanced options

func (*Client) CreateWindow

func (c *Client) CreateWindow(ctx context.Context, profileName string) (*pb.CreateTabResponse, error)

CreateWindow creates a new iTerm2 window

func (*Client) DeleteVariableWithScope

func (c *Client) DeleteVariableWithScope(ctx context.Context, scope string, id string, name string) error

DeleteVariableWithScope deletes/unsets a variable with explicit scope control

func (*Client) ExportColorPreset

func (c *Client) ExportColorPreset(ctx context.Context, name, filePath string) error

ExportColorPreset exports a color preset to an .itermcolors file

func (*Client) ExportKeyBindings

func (c *Client) ExportKeyBindings(ctx context.Context, filename, profile string, global bool) error

ExportKeyBindings exports keyboard bindings to a file

func (*Client) FindText

func (c *Client) FindText(ctx context.Context, sessionID, pattern string, regex, caseSensitive, wholeWord bool, maxResults int32) ([]*FindResult, error)

FindText searches for text patterns in the session buffer

func (*Client) GetAllVariables

func (c *Client) GetAllVariables(ctx context.Context, sessionID, tabID, windowID string) ([]*VariableInfo, error)

GetAllVariables gets all variables from all scopes (requires session/tab/window IDs)

func (*Client) GetBroadcastDomains

func (c *Client) GetBroadcastDomains(ctx context.Context) ([]*BroadcastDomain, error)

GetBroadcastDomains returns the current broadcast domains

func (*Client) GetBufferWithStyles

func (c *Client) GetBufferWithStyles(ctx context.Context, sessionID string, lines int32, includeStyles bool) (*pb.GetBufferResponse, error)

GetBufferWithStyles retrieves the buffer contents of a session with optional style information

func (*Client) GetColorPreset

func (c *Client) GetColorPreset(ctx context.Context, name string) (*ColorPreset, error)

GetColorPreset retrieves the details of a specific color preset

func (*Client) GetContents

func (c *Client) GetContents(ctx context.Context, sessionID string, firstLine, numLines int32) (*pb.GetBufferResponse, error)

GetContents retrieves specific line ranges from a session buffer

func (*Client) GetContentsWithStyles

func (c *Client) GetContentsWithStyles(ctx context.Context, sessionID string, firstLine, numLines int32, includeStyles bool) (*pb.GetBufferResponse, error)

GetContentsWithStyles retrieves specific line ranges from a session buffer with optional style information

func (*Client) GetCursor

func (c *Client) GetCursor(ctx context.Context, sessionID string) (*pb.Coord, error)

GetCursor gets the current cursor position and state

func (*Client) GetFocus

func (c *Client) GetFocus(ctx context.Context) (*FocusInfo, error)

GetFocus gets current focus information

func (*Client) GetMultipleVariablesWithScope

func (c *Client) GetMultipleVariablesWithScope(ctx context.Context, scope string, id string, names []string) (map[string]string, error)

GetMultipleVariablesWithScope gets multiple variable values in a single API call. Returns a map of variable name to value. Variables that don't exist are omitted.

func (*Client) GetPreference

func (c *Client) GetPreference(ctx context.Context, key string) (interface{}, error)

GetPreference gets a single application preference

func (*Client) GetPreferences

func (c *Client) GetPreferences(ctx context.Context, keys []string) (map[string]interface{}, error)

GetPreferences gets multiple application preferences

func (*Client) GetProfile

func (c *Client) GetProfile(ctx context.Context, profileName string) (map[string]interface{}, error)

GetProfile gets all properties for a specific profile by name

func (*Client) GetProfileProperty

func (c *Client) GetProfileProperty(ctx context.Context, profileName, key string) (interface{}, error)

GetProfileProperty gets a specific property for a profile by name Deprecated: Use GetProfile to get all properties at once

func (*Client) GetPrompt

func (c *Client) GetPrompt(ctx context.Context, sessionID string) (*pb.GetPromptResponse, error)

GetPrompt gets information about prompts in a session (requires Shell Integration)

func (*Client) GetPromptByID

func (c *Client) GetPromptByID(ctx context.Context, sessionID, promptID string) (*pb.GetPromptResponse, error)

GetPromptByID gets specific prompt information by unique ID

func (*Client) GetScreenContents

func (c *Client) GetScreenContents(ctx context.Context, sessionID string) (*pb.GetBufferResponse, error)

GetScreenContents retrieves the current screen contents of a session

func (*Client) GetScreenContentsWithStyles

func (c *Client) GetScreenContentsWithStyles(ctx context.Context, sessionID string, includeStyles bool) (*pb.GetBufferResponse, error)

GetScreenContentsWithStyles retrieves the current screen contents of a session with optional style information

func (*Client) GetSelection

func (c *Client) GetSelection(ctx context.Context, sessionID string) (*pb.Selection, error)

GetSelection gets the current text selection for a session

func (*Client) GetSelectionText

func (c *Client) GetSelectionText(ctx context.Context, sessionID string) (string, error)

GetSelectionText gets the text content of the current selection

func (*Client) GetSessionBadge

func (c *Client) GetSessionBadge(ctx context.Context, sessionID string) (string, error)

GetSessionBadge gets the session badge from the "Badge Text" profile property

func (*Client) GetSessionProfileProperty

func (c *Client) GetSessionProfileProperty(ctx context.Context, sessionID, key string) (interface{}, error)

GetSessionProfileProperty gets a profile property from a specific sessions copy of the profile

func (*Client) GetSessionProperty

func (c *Client) GetSessionProperty(ctx context.Context, sessionID, property string) (string, error)

GetSessionProperty gets a session property value

func (*Client) GetTabColor

func (c *Client) GetTabColor(ctx context.Context, tabID string) (red, green, blue float64, enabled bool, err error)

GetTabColor retrieves the current tab color from session-specific profile properties

func (*Client) GetTabTitle

func (c *Client) GetTabTitle(ctx context.Context, tabID string) (string, error)

GetTabTitle gets the tab title from the "user.title" variable in tab scope

func (*Client) GetVariable

func (c *Client) GetVariable(ctx context.Context, sessionID, name string) (string, error)

GetVariable gets the value of a variable (backward compatibility) Deprecated: Use GetVariableWithScope instead

func (*Client) GetVariableWithScope

func (c *Client) GetVariableWithScope(ctx context.Context, scope string, id string, name string) (string, error)

GetVariableWithScope gets a variable value with explicit scope control

func (*Client) GetWindowProperty

func (c *Client) GetWindowProperty(ctx context.Context, windowID, property string) (string, error)

GetWindowProperty retrieves a property value for a window

func (*Client) GetWindowTitle

func (c *Client) GetWindowTitle(ctx context.Context, windowID string) (string, error)

GetWindowTitle gets the window title from the titleOverride variable

func (*Client) HighlightText

func (c *Client) HighlightText(ctx context.Context, sessionID, pattern string, regex, caseSensitive, wholeWord bool, color, background string, duration int32) ([]*HighlightResult, error)

HighlightText creates temporary highlighting for text patterns

func (*Client) ImportColorPreset

func (c *Client) ImportColorPreset(ctx context.Context, name, filePath string) error

ImportColorPreset imports a color preset from an .itermcolors file

func (*Client) ImportKeyBindings

func (c *Client) ImportKeyBindings(ctx context.Context, filename, profile string, global, merge bool) error

ImportKeyBindings imports keyboard bindings from a file

func (*Client) InjectData

func (c *Client) InjectData(ctx context.Context, sessionID string, data []byte) error

InjectData injects data into a session as if it came from the program

func (*Client) InputAlert

func (c *Client) InputAlert(ctx context.Context, prompt, title, defaultText string, secure bool) (interface{}, error)

InputAlert displays an input alert

func (*Client) InvokeFunction

func (c *Client) InvokeFunction(ctx context.Context, invocation string, sessionID, tabID, windowID *string, timeout float64) (interface{}, error)

InvokeFunction invokes a function in iTerm2, possibly as a method call on an object

func (*Client) ListArrangements

func (c *Client) ListArrangements(ctx context.Context) (*pb.SavedArrangementResponse, error)

ListArrangements lists all saved arrangements

func (*Client) ListColorPresets

func (c *Client) ListColorPresets(ctx context.Context) ([]string, error)

ListColorPresets returns a list of available color preset names

func (*Client) ListCustomControls

func (c *Client) ListCustomControls(ctx context.Context) (interface{}, error)

ListCustomControls lists custom controls (placeholder)

func (*Client) ListKeyBindings

func (c *Client) ListKeyBindings(ctx context.Context, profile string, global bool) ([]interface{}, error)

ListKeyBindings lists all keyboard bindings for a profile or globally

func (*Client) ListProfiles

func (c *Client) ListProfiles(ctx context.Context, detailed bool) ([]string, error)

ListProfiles returns profile names, optionally with detailed information This is the main method that should be used

func (*Client) ListProfilesDetailed

func (c *Client) ListProfilesDetailed(ctx context.Context) ([]*pb.ListProfilesResponse_Profile, error)

ListProfilesDetailed returns detailed profile information

func (*Client) ListProfilesSimple

func (c *Client) ListProfilesSimple(ctx context.Context) ([]string, error)

ListProfilesSimple returns just profile names

func (*Client) ListPrompts

func (c *Client) ListPrompts(ctx context.Context, sessionID string) (*pb.ListPromptsResponse, error)

ListPrompts lists historical prompts for a session

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context) ([]*SessionInfo, error)

func (*Client) ListSessionsRaw

func (c *Client) ListSessionsRaw(ctx context.Context) (*pb.ListSessionsResponse, error)

ListSessionsRaw returns the raw protobuf response with full window/tab tree

func (*Client) ListSessionsWithOptions

func (c *Client) ListSessionsWithOptions(ctx context.Context, opts ListSessionsOptions) ([]*SessionInfo, error)

ListSessionsWithOptions returns sessions using the provided options.

func (*Client) ListTmuxConnections

func (c *Client) ListTmuxConnections(ctx context.Context) ([]*TmuxConnection, error)

ListTmuxConnections returns all tmux integration connections

func (*Client) ListVariablesWithScope

func (c *Client) ListVariablesWithScope(ctx context.Context, scope string, id string) ([]string, error)

ListVariablesWithScope lists all variables in a specific scope

func (*Client) ListWindows

func (c *Client) ListWindows(ctx context.Context) ([]*WindowInfo, error)

ListWindows gets a list of all windows with their information

func (*Client) MonitorLifecycle

func (c *Client) MonitorLifecycle(ctx context.Context, sessionID string, follow bool) (interface{}, error)

MonitorLifecycle monitors lifecycle events (placeholder)

func (*Client) MonitorSession

func (c *Client) MonitorSession(ctx context.Context, sessionID string, events []string) (<-chan *pb.PromptNotification, error)

MonitorSession starts monitoring a session for prompt events

func (*Client) MonitorVariable

func (c *Client) MonitorVariable(ctx context.Context, scope, identifier, name string) (<-chan string, error)

MonitorVariable starts monitoring a variable for changes using VariableMonitorRequest

func (*Client) MoveSession

func (c *Client) MoveSession(ctx context.Context, sourceSessionID, destSessionID string, vertical, before bool) error

MoveSession moves a session to be a split pane next to another session using iTerm2's built-in iterm2.move_session function.

Parameters:

  • sourceSessionID: The session to move
  • destSessionID: The destination session to split
  • vertical: If true, split destination vertically; if false, horizontally
  • before: If true, place source before/above destination; if false, after/below

The function will fail if:

  • Either session ID is invalid
  • Sessions are not compatible (e.g., tmux vs non-tmux)
  • Either session has no tab
  • Either session is locked
  • Panes are maximized (will auto-unmaximize)

func (*Client) OpenFilePanel

func (c *Client) OpenFilePanel(ctx context.Context, title, directory string, types []string, multiple bool) (interface{}, error)

OpenFilePanel opens a file selection panel

func (*Client) PasteFromClipboardWithOptions

func (c *Client) PasteFromClipboardWithOptions(ctx context.Context, sessionID string, restoreFocus bool) error

PasteFromClipboardWithOptions pastes clipboard content with optional focus restoration

func (*Client) PostNotification

func (c *Client) PostNotification(ctx context.Context, message string) (interface{}, error)

PostNotification posts a notification to macOS Notification Center

func (*Client) ReadNotification

func (c *Client) ReadNotification(ctx context.Context) (*pb.ServerOriginatedMessage, error)

ReadNotification reads the next notification from the message stream

func (*Client) RegisterCustomControl

func (c *Client) RegisterCustomControl(ctx context.Context, controlID, controlType, configStr string) (interface{}, error)

RegisterCustomControl registers a custom control (placeholder)

func (*Client) RegisterRPC

func (c *Client) RegisterRPC(ctx context.Context, rpcName, sessionID string) (interface{}, error)

RegisterRPC registers an RPC handler (placeholder)

func (*Client) ReorderTabs

func (c *Client) ReorderTabs(ctx context.Context, assignments map[string][]string) (*pb.ReorderTabsResponse, error)

ReorderTabs reorders tabs within windows

func (*Client) ReplaceText

func (c *Client) ReplaceText(ctx context.Context, sessionID, pattern, replacement string, regex, caseSensitive, wholeWord bool, maxReplacements int32, confirm bool) ([]*ReplaceResult, error)

ReplaceText replaces text patterns in the session buffer

func (*Client) ResetSessionBadgeToProfile

func (c *Client) ResetSessionBadgeToProfile(ctx context.Context, sessionID string) error

ResetSessionBadgeToProfile copies the profile's badge to the session badge

func (*Client) ResolveSessionID

func (c *Client) ResolveSessionID(ctx context.Context, sessionID string) (string, error)

ResolveSessionID resolves a session ID with intelligent fallback and prefix matching 1. If sessionID is empty, uses $ITERM_SESSION_ID environment variable 2. Normalizes the session ID format (removes ITERM_SESSION_ID prefix if present) 3. Expands short session ID prefixes to full IDs by matching against available sessions

func (*Client) ResolveTabID

func (c *Client) ResolveTabID(ctx context.Context, tabID string) (string, error)

ResolveTabID resolves a tab ID with intelligent fallback and prefix matching 1. If tabID is empty, finds the tab ID of the current session 2. Supports prefix matching for tab IDs (4+ chars minimum) 3. Returns the tab ID as-is if it's a complete match

func (*Client) ResolveWindowID

func (c *Client) ResolveWindowID(ctx context.Context, windowID string) (string, error)

ResolveWindowID resolves a window ID with intelligent fallback and prefix matching 1. If windowID is empty, finds the window ID of the current session 2. Supports prefix matching for window IDs (4+ chars minimum) 3. Returns the window ID as-is if it's a complete match

func (*Client) RestartSession

func (c *Client) RestartSession(ctx context.Context, sessionID string, onlyIfExited bool) (*pb.RestartSessionResponse, error)

RestartSession restarts a session

func (*Client) RestoreArrangement

func (c *Client) RestoreArrangement(ctx context.Context, name string) (*pb.SavedArrangementResponse, error)

RestoreArrangement restores a saved window layout

func (*Client) SaveArrangement

func (c *Client) SaveArrangement(ctx context.Context, name string, windowID string) (*pb.SavedArrangementResponse, error)

SaveArrangement saves the current window layout with a given name

func (*Client) SaveFilePanel

func (c *Client) SaveFilePanel(ctx context.Context, title, directory, filename string, types []string) (interface{}, error)

SaveFilePanel opens a file save panel

func (*Client) SendRequest

func (*Client) SendText

func (c *Client) SendText(ctx context.Context, sessionID, text string) error

SendText sends text to a session as if typed by the user, automatically splitting large text into 4KB chunks

func (*Client) SendTmuxCommand

func (c *Client) SendTmuxCommand(ctx context.Context, connectionID, command string) (string, error)

SendTmuxCommand sends a command to a tmux connection and returns the output

func (*Client) SetBroadcastDomains

func (c *Client) SetBroadcastDomains(ctx context.Context, domains []*BroadcastDomain) error

SetBroadcastDomains sets the broadcast domains

func (*Client) SetCursor

func (c *Client) SetCursor(ctx context.Context, sessionID string, x int32, y int64) error

SetCursor sets the cursor to a specific position

func (*Client) SetGridSize

func (c *Client) SetGridSize(ctx context.Context, sessionID string, width, height int32) error

SetGridSize sets the terminal grid size for a session

func (*Client) SetPreference

func (c *Client) SetPreference(ctx context.Context, key string, value interface{}) error

SetPreference sets a single application preference

func (*Client) SetPreferences

func (c *Client) SetPreferences(ctx context.Context, prefs map[string]interface{}) error

SetPreferences sets multiple application preferences

func (*Client) SetProfileProperties

func (c *Client) SetProfileProperties(ctx context.Context, profileName string, properties map[string]interface{}) error

SetProfileProperties sets multiple properties for a profile efficiently This avoids repeated GUID lookups by doing it once upfront

func (*Client) SetProfileProperty

func (c *Client) SetProfileProperty(ctx context.Context, profileName, key string, value interface{}) error

SetProfileProperty sets a specific property for a profile by name

func (*Client) SetSelection

func (c *Client) SetSelection(ctx context.Context, sessionID, start, end string) error

SetSelection sets text selection for a session using start/end position strings Deprecated: Use SetSelectionRange instead for explicit coordinate handling

func (*Client) SetSelectionRange

func (c *Client) SetSelectionRange(ctx context.Context, sessionID string, startX int32, startY int64, endX int32, endY int64, mode string) error

SetSelectionRange sets selection using explicit coordinates

func (*Client) SetSessionBadge

func (c *Client) SetSessionBadge(ctx context.Context, sessionID, badge string) error

SetSessionBadge sets the session badge by setting the "Badge Text" profile property

func (*Client) SetSessionName

func (c *Client) SetSessionName(ctx context.Context, sessionID, name string) error

SetSessionName sets the session name by setting the Name profile property

func (*Client) SetSessionProfileProperty

func (c *Client) SetSessionProfileProperty(ctx context.Context, sessionID, key, value string) error

SetSessionProfileProperty sets a profile property on a specific sessions copy of the profile without modifying the underlying profile. This enables per-session customization.

func (*Client) SetSessionProperty

func (c *Client) SetSessionProperty(ctx context.Context, sessionID, property, value string) error

SetSessionProperty sets a session property value

func (*Client) SetTabColor

func (c *Client) SetTabColor(ctx context.Context, tabID string, red, green, blue float64) error

SetTabColor sets the tab color using session-specific profile properties The color is specified as normalized RGB values (0.0-1.0)

func (*Client) SetTabLayout

func (c *Client) SetTabLayout(ctx context.Context, tabID string, root *pb.SplitTreeNode) (*pb.SetTabLayoutResponse, error)

SetTabLayout sets the layout of a tab

func (*Client) SetTabTitle

func (c *Client) SetTabTitle(ctx context.Context, tabID, title string) error

SetTabTitle sets the tab title by setting the "user.title" variable in tab scope

func (*Client) SetVariable

func (c *Client) SetVariable(ctx context.Context, sessionID, name, value string) error

SetVariable sets the value of a variable (backward compatibility) Deprecated: Use SetVariableWithScope instead

func (*Client) SetVariableWithScope

func (c *Client) SetVariableWithScope(ctx context.Context, scope string, id string, name string, value string) error

SetVariableWithScope sets a variable value with explicit scope control

func (*Client) SetWindowProperty

func (c *Client) SetWindowProperty(ctx context.Context, windowID, property, value string) error

SetWindowProperty sets a property value for a window

func (*Client) SetWindowTitle

func (c *Client) SetWindowTitle(ctx context.Context, windowID, title string) error

SetWindowTitle sets the window title by setting the user.title variable

func (*Client) ShowAlert

func (c *Client) ShowAlert(ctx context.Context, message, title string) (interface{}, error)

ShowAlert displays an alert dialog

func (*Client) SplitPane

func (c *Client) SplitPane(ctx context.Context, sessionID string, vertical bool, before bool, profileName string, customProps []*pb.ProfileProperty) (*pb.SplitPaneResponse, error)

SplitPane splits a session pane vertically or horizontally

func (*Client) SubscribeToGenericNotifications

func (c *Client) SubscribeToGenericNotifications(ctx context.Context, notificationType string, sessionID string) (<-chan *pb.Notification, error)

SubscribeToGenericNotifications subscribes to iTerm2 notifications and returns raw notification objects This is a simplified version that returns the raw notification for the caller to process

func (*Client) SubscribeToKeystrokes

func (c *Client) SubscribeToKeystrokes(ctx context.Context, sessionID string) error

SubscribeToKeystrokes subscribes to keystroke notifications for a session

func (*Client) SubscribeToNotification

func (c *Client) SubscribeToNotification(ctx context.Context, notificationType pb.NotificationType) error

InvokeMethod invokes a method on an iTerm2 object (convenience wrapper around InvokeFunction) SubscribeToNotification subscribes to a specific notification type

func (*Client) SubscribeToScreenUpdates

func (c *Client) SubscribeToScreenUpdates(ctx context.Context, sessionID string) error

SubscribeToScreenUpdates subscribes to screen update notifications for a session

func (*Client) TabContainsSession

func (c *Client) TabContainsSession(node *pb.SplitTreeNode, sessionID string) bool

TabContainsSession recursively checks if a tab tree contains the given session ID

func (*Client) UnbindKey

func (c *Client) UnbindKey(ctx context.Context, key, profile string, global bool) error

UnbindKey removes a keyboard binding

func (*Client) UnregisterCustomControl

func (c *Client) UnregisterCustomControl(ctx context.Context, controlID string) (interface{}, error)

UnregisterCustomControl unregisters a custom control (placeholder)

func (*Client) UnregisterRPC

func (c *Client) UnregisterRPC(ctx context.Context, rpcName, sessionID string) (interface{}, error)

UnregisterRPC unregisters an RPC handler (placeholder)

func (*Client) UnsubscribeFromNotifications

func (c *Client) UnsubscribeFromNotifications(ctx context.Context, notificationType, sessionID string) error

UnsubscribeFromNotifications unsubscribes from specific notification types

func (*Client) UpdateCustomControl

func (c *Client) UpdateCustomControl(ctx context.Context, controlID string, data interface{}) (interface{}, error)

UpdateCustomControl updates a custom control (placeholder)

type ColorPreset

type ColorPreset struct {
	Name     string
	Settings map[string]*ColorSetting
}

ColorPreset represents a color preset with its settings

type ColorSetting

type ColorSetting struct {
	Red        float32
	Green      float32
	Blue       float32
	Alpha      float32
	ColorSpace string
}

ColorSetting represents a single color setting

type Dict

type Dict struct {
	Keys   []string `xml:"key"`
	Values []Value  `xml:"dict"`
}

Dict represents a dictionary element in plist

type FindResult

type FindResult struct {
	Line     int64  `json:"line"`
	Column   int32  `json:"column"`
	Text     string `json:"text"`
	Context  string `json:"context"`
	LineText string `json:"line_text"`
}

FindResult represents a text search result

type FocusInfo

type FocusInfo struct {
	ApplicationFocused bool   `json:"application_focused"`
	WindowId           string `json:"window_id,omitempty"`
	TabId              string `json:"tab_id,omitempty"`
	SessionId          string `json:"session_id,omitempty"`
}

FocusInfo represents current focus state

type HighlightResult

type HighlightResult struct {
	Line        int64  `json:"line"`
	Column      int32  `json:"column"`
	Text        string `json:"text"`
	Color       string `json:"color"`
	Duration    int32  `json:"duration"`
	HighlightID string `json:"highlight_id"`
}

HighlightResult represents a text highlighting result

type ITerm2ColorPreset

type ITerm2ColorPreset struct {
	XMLName xml.Name `xml:"plist"`
	Dict    Dict     `xml:"dict"`
}

ITerm2ColorPreset represents the structure of an .itermcolors file

type KeyBinding

type KeyBinding struct {
	Key         string `json:"key"`
	Action      string `json:"action"`
	Profile     string `json:"profile,omitempty"`
	Global      bool   `json:"global,omitempty"`
	Description string `json:"description,omitempty"`
}

KeyBinding represents a keyboard binding configuration

type ListSessionsOptions

type ListSessionsOptions struct {
	IncludeBuried  bool
	IncludeJobInfo bool // populate process info (pgrep, API calls per session); expensive with many sessions
}

ListSessionsOptions controls optional session listing behaviour.

type ReplaceResult

type ReplaceResult struct {
	Line         int64  `json:"line"`
	Column       int32  `json:"column"`
	OriginalText string `json:"original_text"`
	NewText      string `json:"new_text"`
	Success      bool   `json:"success"`
}

ReplaceResult represents a text replacement result

type SessionInfo

type SessionInfo struct {
	SessionID       string
	ShortID         string // First 8 characters of SessionID for easier reference
	ParentSessionID string // Parent session ID if this is a split pane
	SplitVertical   *bool  // Direction of split from parent (nil if no parent, true=vertical, false=horizontal)
	WindowID        string
	WindowNumber    int32 // iTerm2 window index
	TabID           string
	WindowTitle     string
	TabTitle        string
	SessionName     string
	PluginData      map[string]interface{} // Additional data from plugins
	Frame           *pb.Frame              // Frame coordinates if available
	GridSize        *pb.Size               // Grid size if available

	// Command information from shell integration
	CurrentCommand   string // Current command from GetPrompt
	ExitCode         uint32 // Last command exit status
	PromptState      string // Shell prompt state (AT_COMMAND_LINE, IN_COMMAND, etc.)
	CommandCount     int32  // Number of commands executed
	ShellPID         int32  // Process ID of the shell
	JobPID           int32  // Process ID of current job
	ProcessName      string // Name of the primary running process (from JobPID)
	WorkingDirectory string // Current working directory from session.path
}

type TmuxConnection

type TmuxConnection struct {
	ConnectionId    string `json:"connection_id"`
	OwningSessionId string `json:"owning_session_id"`
}

TmuxConnection represents a tmux integration connection

type Value

type Value struct {
	Keys    []string  `xml:"key"`
	Reals   []float64 `xml:"real"`
	Strings []string  `xml:"string"`
}

Value represents a dictionary value in plist

type VariableInfo

type VariableInfo struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Scope string `json:"scope"`
	ID    string `json:"id,omitempty"`
}

VariableInfo represents variable information for listing

type WindowInfo

type WindowInfo struct {
	WindowID     string                 `json:"window_id"`
	WindowNumber int32                  `json:"window_number"` // iTerm2 window index
	Title        string                 `json:"title,omitempty"`
	Frame        string                 `json:"frame,omitempty"`
	Fullscreen   string                 `json:"fullscreen,omitempty"`
	Miniaturized string                 `json:"miniaturized,omitempty"`
	TabCount     int                    `json:"tab_count"`
	SessionCount int                    `json:"session_count,omitempty"`
	PluginData   map[string]interface{} `json:"plugin_data,omitempty"`
}

WindowInfo represents window information for client functions

Jump to

Keyboard shortcuts

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