iTerm Module Reference
New in version 0.1.0.
Control iTerm using JXA-like syntax.
Classes:
|
A class for managing and interacting with iTerm.app. |
|
A hotkey window of iTerm.app. |
|
A session of iTerm.app. |
|
A tab of iTerm.app. |
|
A window of iTerm.app. |
- class PyXA.apps.iTerm.XAiTermApplication(properties)[source]
Bases:
XASBApplication
A class for managing and interacting with iTerm.app.
New in version 0.1.0.
Methods:
create_hotkey_window
([profile])Creates a new hotkey window with the given profile.
create_window
([profile, command])Creates a new window with the given profile, executing the specified command upon the window's creation.
invoke_api_expression
(expression)Invokes an expression, such as a registered function.
launch_api_script
(script_name[, arguments])Launches an API script by name, providing it with the given arguments.
Requests a Python API cookie for the specified application.
Attributes:
The frontmost window.
Whether iTerm is the active application.
The name of the application.
The version of iTerm.app.
- create_hotkey_window(profile: str | None = None) XAiTermHotkeyWindow [source]
Creates a new hotkey window with the given profile.
- Parameters:
profile (Union[str, None], optional) – The profile to initialize the window with, defaults to None
- Returns:
The newly created hotkey window object
- Return type:
New in version 0.1.0.
- create_window(profile: str | None = None, command: str | None = None) XAiTermWindow [source]
Creates a new window with the given profile, executing the specified command upon the window’s creation.
- Parameters:
profile (Union[str, None], optional) – The profile to initialize the window with, defaults to None (default profile)
command (Union[str, None], optional) – The command to execute, defaults to None
- Returns:
The newly created window object
- Return type:
New in version 0.1.0.
- property current_window: XAiTermWindow
The frontmost window.
- property frontmost: bool
Whether iTerm is the active application.
- invoke_api_expression(expression: str)[source]
Invokes an expression, such as a registered function.
- Parameters:
expression (str) – The expression to invoke
New in version 0.1.0.
- launch_api_script(script_name: str, arguments: list[str] | None = None)[source]
Launches an API script by name, providing it with the given arguments.
- Parameters:
script_name (str) – The name of the script to launch
arguments (Union[list[str], None], optional) – The arguments to pass to the script, defaults to None
New in version 0.1.0.
- property name: str
The name of the application.
- request_cookie_and_key(app: str) str [source]
Requests a Python API cookie for the specified application.
- Parameters:
app (str) – The app to retrieve an API cookie for
- Returns:
The API cookie
- Return type:
str
New in version 0.1.0.
- property version: str
The version of iTerm.app.
- class PyXA.apps.iTerm.XAiTermHotkeyWindow(properties)[source]
Bases:
XAiTermWindow
A hotkey window of iTerm.app.
New in version 0.1.0.
Methods:
Hides the hotkey window.
Reveals the hotkey window.
Toggles the hotkey window.
- class PyXA.apps.iTerm.XAiTermSession(properties)[source]
Bases:
XAObject
,XACloseable
,XASelectable
A session of iTerm.app.
New in version 0.1.0.
Attributes:
ENQ Answerback string.
The path of the background image file.
The color preset of the session.
The number of columns in the terminal window.
The currently visible contents of the session.
The unique identifier of the session.
Whether the terminal is at the shell prompt.
Whether the session is currently processing.
The name of the session.
The session's profile name.
The number of rows in the terminal window.
The currently visible contents of the session.
The transparency of the session window.
The current TTY.
The unique identifier of the session.
Whether to use a dedicated color for underlining.
Methods:
close
()Closes the session.
set_variable
(variable_name, value)Sets the value of a session variable.
split_horizontally
([profile, command])Splits the session horizontally, instantiating a new session with the specified profile.
Splits the session horizontally, instantiating a new session with the default profile.
split_vertically
([profile, command])Splits the session vertically, instantiating a new session with the specified profile.
Splits the session vertically, instantiating a new session with the default profile.
variable
(variable_name)Returns the value of a session variable with the given name.
write
([text, file, add_newline])Writes a string or file contents to the session.
- property answerback_string: str
ENQ Answerback string.
- property background_image: str
The path of the background image file.
- property color_preset: str
The color preset of the session.
- property columns: int
The number of columns in the terminal window.
- property contents: str
The currently visible contents of the session.
- property id: str
The unique identifier of the session.
- property is_at_shell_prompt: bool
Whether the terminal is at the shell prompt.
- property is_processing: bool
Whether the session is currently processing.
- property name: str
The name of the session.
- property profile_name: str
The session’s profile name.
- property rows: int
The number of rows in the terminal window.
- set_variable(variable_name: str, value: str) str [source]
Sets the value of a session variable.
- Parameters:
variable_name (str) – The name of the variable to set
value (str) – The value to give the variable
- Returns:
The new value of the variable
- Return type:
str
New in version 0.1.0.
- split_horizontally(profile: str | None = None, command: str | None = None)[source]
Splits the session horizontally, instantiating a new session with the specified profile.
- Parameters:
profile (Union[str, None], optional) – The profile to instantiate the new session with, defaults to None (current profile)
command (Union[str, None], optional) – The command to run in the newly created session upon its creation, defaults to None
New in version 0.1.0.
- split_horizontally_with_default_profile(command: str | None = None)[source]
Splits the session horizontally, instantiating a new session with the default profile.
- Parameters:
command (Union[str, None]) – The command to run in the newly created session upon its creation, defaults to None
New in version 0.1.0.
- split_vertically(profile: str | None = None, command: str | None = None)[source]
Splits the session vertically, instantiating a new session with the specified profile.
- Parameters:
profile (Union[str, None], optional) – The profile to instantiate the new session with, defaults to None (current profile)
command (Union[str, None], optional) – The command to run in the newly created session upon its creation, defaults to None
New in version 0.1.0.
- split_vertically_with_default_profile(command: str | None)[source]
Splits the session vertically, instantiating a new session with the default profile.
- Parameters:
command (Union[str, None]) – The command to run in the newly created session upon its creation, defaults to None
New in version 0.1.0.
- property text: str
The currently visible contents of the session.
- property transparency: float
The transparency of the session window.
- property tty: str
The current TTY.
- property unique_id: str
The unique identifier of the session.
- property use_underline_color: bool
Whether to use a dedicated color for underlining.
- variable(variable_name: str) str [source]
Returns the value of a session variable with the given name.
- Parameters:
variable_name (str) – The name of the variable to retrieve the value on
- Returns:
The value of the variable
- Return type:
str
New in version 0.1.0.
- write(text: str | None = None, file: str | XAPath | None = None, add_newline: bool = True)[source]
Writes a string or file contents to the session.
- Parameters:
text (Union[str, None], optional) – The text to input into the session, defaults to None
file (Union[XABase.XAPath, str, None], optional) – The file whose contents to input into the session, defaults to None
add_newline (bool, optional) – Whether to add a new line after inputting the specified content, defaults to True
New in version 0.1.0.
- class PyXA.apps.iTerm.XAiTermTab(properties)[source]
Bases:
XAObject
,XACloseable
,XASelectable
A tab of iTerm.app.
New in version 0.1.0.
Methods:
close
()Closes the tab.
move_to
(window)Attributes:
The current session in a tab.
Index of tab in parent tab view control.
- property current_session: XAiTermSession
The current session in a tab.
- property index: int
Index of tab in parent tab view control.
- move_to(window: XAiTermWindow)[source]
- class PyXA.apps.iTerm.XAiTermWindow(properties)[source]
Bases:
XASBWindow
,XAObject
,XASelectable
,XACloseable
A window of iTerm.app.
New in version 0.1.0.
Attributes:
The alternate unique identifier of the session.
The current session in a window.
The currently selected tab.
Whether the window is currently the frontmost iTerm window.
If the window is a hotkey window, this gives the name of the profile that created the window.
Whether the window is a hotkey window.
The position of the window, relative to the upper left corner of the screen.
Methods:
close
()Closes the window.
create_tab
([profile, command])Creates a new tab with the given profile, executing the specified command upon the tab's creation.
- property alternate_identifier: str
The alternate unique identifier of the session.
- create_tab(profile: str | None = None, command: str | None = None)[source]
Creates a new tab with the given profile, executing the specified command upon the tab’s creation.
- Parameters:
profile (Union[str, None], optional) – The name of the profile to assign to the tab, if any, defaults to None (default profile)
command (Union[str, None], optional) – The command to run in the tab, if any, defaults to None
- property current_session: XAiTermSession
The current session in a window.
- property current_tab: XAiTermTab
The currently selected tab.
- property frontmost: bool
Whether the window is currently the frontmost iTerm window.
- property hotkey_window_profile: str
If the window is a hotkey window, this gives the name of the profile that created the window.
- property is_hotkey_window: bool
Whether the window is a hotkey window.
- property position: tuple[int, int]
The position of the window, relative to the upper left corner of the screen.