Alert

Enables showing modal alerts.

class Alert(title: str, subtitle: str, window_id: Optional[str] = None)

A modal alert.

Parameters
  • title – The title, shown in bold at the top.

  • subtitle – The informative text, which may be more than one line long.

  • window_id – The window to attach the alert to. If None, it will be application modal.

See also

Example “One-Shot Alert

add_button(title: str)

Adds a button to the end of the list of buttons.

async async_run(connection: iterm2.connection.Connection) → int

Shows the modal alert.

Return type

int

Parameters

connection (Connection) – The connection to use.

Returns

The index of the selected button. If no buttons were defined then a single button, “OK”, is automatically added.

Throws

RPCException if something goes wrong.

property subtitle

Returns the subtitle string

property title

Returns the title string

class TextInputAlert(title: str, subtitle: str, placeholder: str, default_value: str, window_id: Optional[str] = None)

A modal alert with a text input accessory.

Parameters
  • title – The title, shown in bold at the top.

  • subtitle – The informative text, which may be more than one line long.

  • placeholder – Grayed-out text to show in the text field when it is empty.

  • default_value – Default text to place in the text field.

  • window_id – Window ID to attach to, or None to make app-modal.

async async_run(connection: iterm2.connection.Connection) → Optional[str]

Shows the modal alert.

Parameters

connection (Connection) – The connection to use.

Returns

The string entered, or None if the alert was canceled.

Throws

RPCException if something goes wrong.

property default_value

Returns the default value.

property placeholder

Returns the placeholder string

property subtitle

Returns the subtitle string

property title

Returns the title string

property window_id

Returns the window ID


Indices and tables