Control kitty from scripts#

kitty can be controlled from scripts or the shell prompt. You can open new windows, send arbitrary text input to any window, change the title of windows and tabs, etc.

Let’s walk through a few examples of controlling kitty.

Tutorial#

Start by running kitty as:

kitty -o allow_remote_control=yes -o enabled_layouts=tall

In order for control to work, allow_remote_control must be enabled in kitty.conf. Here we turn it on explicitly at the command line.

Now, in the new kitty window, enter the command:

kitty @ launch --title Output --keep-focus cat

This will open a new window, running the cat program that will appear next to the current window.

Let’s send some text to this new window:

kitty @ send-text --match cmdline:cat Hello, World

This will make Hello, World show up in the window running the cat program. The kitty @ send-text --match option is very powerful, it allows selecting windows by their titles, the command line of the program running in the window, the working directory of the program running in the window, etc. See kitty @ send-text --help for details.

More usefully, you can pipe the output of a command running in one window to another window, for example:

ls | kitty @ send-text --match title:^Output --stdin

This will show the output of ls in the output window instead of the current window. You can use this technique to, for example, show the output of running make in your editor in a different window. The possibilities are endless.

You can even have things you type show up in a different window. Run:

kitty @ send-text --match title:^Output --stdin

And type some text, it will show up in the output window, instead of the current window. Type Ctrl+D when you are ready to stop.

Now, let’s open a new tab:

kitty @ launch --type=tab --tab-title "My Tab" --keep-focus bash

This will open a new tab running the bash shell with the title “My Tab”. We can change the title of the tab to “New Title” with:

kitty @ set-tab-title --match title:^My New Title

Let’s change the title of the current tab:

kitty @ set-tab-title Master Tab

Now lets switch to the newly opened tab:

kitty @ focus-tab --match title:^New

Similarly, to focus the previously opened output window (which will also switch back to the old tab, automatically):

kitty @ focus-window --match title:^Output

You can get a listing of available tabs and windows, by running:

kitty @ ls

This outputs a tree of data in JSON format. The top level of the tree is all OS windows. Each OS window has an id and a list of tabs. Each tab has its own id, a title and a list of kitty windows. Each window has an id, title, current working directory, process id (PID) and command-line of the process running in the window. You can use this information with kitty @ focus-window --match to control individual windows.

As you can see, it is very easy to control kitty using the kitty @ messaging system. This tutorial touches only the surface of what is possible. See kitty @ --help for more details.

Note that in the example’s above, kitty @ messaging works only when run inside a kitty window, not anywhere. But, within a kitty window it even works over SSH. If you want to control kitty from programs/scripts not running inside a kitty window, you have to implement a couple of extra steps. First start kitty as:

kitty -o allow_remote_control=yes --listen-on unix:/tmp/mykitty

The kitty --listen-on option tells kitty to listen for control messages at the specified UNIX-domain socket. See kitty --help for details. Now you can control this instance of kitty using the kitty @ --to command line argument to kitty @. For example:

kitty @ --to unix:/tmp/mykitty ls

Note that if all you want to do is run a single kitty “daemon” and have subsequent kitty invocations appear as new top-level windows, you can use the simpler kitty --single-instance option, see kitty --help for that.

The builtin kitty shell#

You can explore the kitty command language more easily using the builtin kitty shell. Run kitty @ with no arguments and you will be dropped into the kitty shell with completion for kitty command names and options.

You can even open the kitty shell inside a running kitty using a simple keyboard shortcut (ctrl+shift+escape by default).

Note

This has the added advantage that you don’t need to use allow_remote_control to make it work.

Allowing only some windows to control kitty#

If you do not want to allow all programs running in kitty to control it, you can selectively enable remote control for only some kitty windows. Simply create a shortcut such as:

map ctrl+k launch --allow-remote-control some_program

Then programs running in windows created with that shortcut can use kitty @ to control kitty. Note that any program with the right level of permissions can still write to the pipes of any other program on the same computer and therefore can control kitty. It can, however, be useful to block programs running on other computers (for example, over SSH) or as other users.

Note

You don’t need allow_remote_control to make this work as it is limited to only programs running in that specific window. Be careful with what programs you run in such windows, since they can effectively control kitty, as if you were running with allow_remote_control turned on.

Mapping key presses to remote control commands#

If you wish to trigger a remote control command easily with just a keypress, you can map it in kitty.conf. For example:

map f1 remote_control set-spacing margin=30

Then pressing the F1 key will set the active window margins to 30. The syntax for what follows remote_control is exactly the same as the syntax for what follows kitty @ above.

Note

You do not need allow_remote_control to use these mappings, as they are not actual remote programs, but are simply a way to resuse the remote control infrastructure via keybings.

Broadcasting what you type to all kitty windows#

As a simple illustration of the power of remote control, lets have what we type sent to all open kitty windows. To do that define the following mapping in kitty.conf:

map f1 launch --allow-remote-control kitty +kitten broadcast

Now press F1 and start typing, what you type will be sent to all windows, live, as you type it.

The remote control protocol#

If you wish to develop your own client to talk to kitty, you can use the remote control protocol specification.

Matching windows and tabs#

Many remote control operations operate on windows or tabs. To select these, the --match option is often used. This allows matching using various sophisticated criteria such as title, ids, cmdlines, etc. These criteria are expressions of the form field:query. Where field is the field against which to match and query is the expression to match. They can be further combined using Boolean operators, best illustrated with some examples:

title:"My special window" or id:43
title:bash and env:USER=kovid
not id:1
(id:2 or id:3) and title:something

kitty @#

kitty @ [options] command ...

Control kitty by sending it commands. Set the allow_remote_control option to yes in kitty.conf for this to work.

Options#

--to <TO>#

An address for the kitty instance to control. Corresponds to the address given to the kitty instance via the kitty --listen-on option. If not specified, messages are sent to the controlling terminal for this process, i.e. they will only work if this process is run within an existing kitty window.

kitty @ close-tab#

kitty @ close-tab [options]

Close an arbitrary set of tabs. The --match option can be used to specify complex sets of tabs to close. For example, to close all non-focused tabs in the currently focused OS window, use:

kitty @ close-tab --match "not state:focused and state:parent_focused"

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--self#

Close the tab of the window this command is run in, rather than the active tab.

kitty @ close-window#

kitty @ close-window [options]

Close the specified windows

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--self#

Close the window this command is run in, rather than the active window.

kitty @ create-marker#

kitty @ create-marker [options] MARKER SPECIFICATION

Create a marker which can highlight text in the specified window. For example: create_marker text 1 ERROR. For full details see: Mark text on screen

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--self#

Apply marker to the window this command is run in, rather than the active window.

kitty @ detach-tab#

kitty @ detach-tab [options]

Detach the specified tabs and either move them into a new OS window or add them to the OS window containing the tab specified by kitty @ detach-tab --target-tab

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--target-tab <TARGET_TAB>, -t <TARGET_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--self#

Detach the tab this command is run in, rather than the active tab.

kitty @ detach-window#

kitty @ detach-window [options]

Detach the specified windows and either move them into a new tab, a new OS window or add them to the specified tab. Use the special value new for kitty @ detach-window --target-tab to move to a new tab. If no target tab is specified the windows are moved to a new OS window.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--target-tab <TARGET_TAB>, -t <TARGET_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs. Use the special value new to move to a new tab.

--self#

Detach the window this command is run in, rather than the active window.

kitty @ disable-ligatures#

kitty @ disable-ligatures [options] STRATEGY

Control ligature rendering for the specified windows/tabs (defaults to active window). The STRATEGY can be one of: never, always, cursor.

Options#

--all, -a#

By default, ligatures are only affected in the active window. This option will cause ligatures to be changed in all windows.

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--match-tab <MATCH_TAB>, -t <MATCH_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ env#

kitty @ env env_var1=val env_var2=val ...

Change the environment variables that will be seen in newly launched windows. Similar to the env option in kitty.conf, but affects running kitty instances. Empty values cause the environment variable to be removed.

kitty @ focus-tab#

kitty @ focus-tab [options]

The active window in the specified tab will be focused.

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--no-response#

Don’t wait for a response indicating the success of the action. Note that using this option means that you will not be notified of failures. Default: false

kitty @ focus-window#

kitty @ focus-window [options]

Focus the specified window, if no window is specified, focus the window this command is run inside.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--no-response#

Don’t wait for a response from kitty. This means that even if no matching window is found, the command will exit with a success code. Default: false

kitty @ get-colors#

kitty @ get-colors [options] ...

Get the terminal colors for the specified window (defaults to active window). Colors will be output to stdout in the same syntax as used for kitty.conf.

Options#

--configured, -c#

Instead of outputting the colors for the specified window, output the currently configured colors.

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

kitty @ get-text#

kitty @ get-text [options]

Get text from the specified window

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--extent <EXTENT>#

What text to get. The default of screen means all text currently on the screen. all means all the screen+scrollback and selection means the currently selected text. first_cmd_output_on_screen means the output of the first command that was run in the window on screen. last_cmd_output means the output of the last command that was run in the window. last_visited_cmd_output means the first command output below the last scrolled position via scroll_to_prompt. last_non_empty_output is the output from the last command run in the window that had some non empty output. The last four require Shell integration to be enabled. Default: screen Choices: all, first_cmd_output_on_screen, last_cmd_output, last_non_empty_output, last_visited_cmd_output, screen, selection

--ansi#

By default, only plain text is returned. With this flag, the text will include the ANSI formatting escape codes for colors, bold, italic, etc.

--add-cursor#

Add ANSI escape codes specifying the cursor position and style to the end of the text.

--add-wrap-markers#

Add carriage returns at every line wrap location (where long lines are wrapped at screen edges).

--clear-selection <CLEAR_SELECTION>#

Clear the selection in the matched window, if any.

--self#

Get text from the window this command is run in, rather than the active window.

kitty @ goto-layout#

kitty @ goto-layout [options] LAYOUT_NAME

Set the window layout in the specified tabs (or the active tab if not specified). You can use special match value all to set the layout in all tabs.

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ kitten#

kitty @ kitten [options] kitten_name

Run a kitten over the specified windows (active window by default). The kitten_name can be either the name of a builtin kitten or the path to a Python file containing a custom kitten. If a relative path is used it is searched for in the kitty config directory. If the kitten is a no_ui kitten and its handle response method returns a string or boolean, this is printed out to stdout.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

kitty @ last-used-layout#

kitty @ last-used-layout [options] ...

Switch to the last used window layout in the specified tabs (or the active tab if not specified).

Options#

--all, -a#

Change the layout in all tabs.

--no-response#

Don’t wait for a response from kitty. This means that even if no matching tab is found, the command will exit with a success code. Default: false

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ launch#

kitty @ launch [options] [CMD ...]

Prints out the id of the newly opened window. Any command line arguments are assumed to be the command line used to run in the new window, if none are provided, the default shell is run. For example: kitty @ launch --title=Email mutt

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--no-response#

Do not print out the id of the newly created window.

--self#

If specified the tab containing the window this command is run in is used instead of the active tab

--title <WINDOW_TITLE>, --window-title <WINDOW_TITLE>#

The title to set for the new window. By default, title is controlled by the child process. The special value current will copy the title from the currently active window.

--tab-title <TAB_TITLE>#

The title for the new tab if launching in a new tab. By default, the title of the active window in the tab is used as the tab title. The special value current will copy the title from the title of the currently active tab.

--type <TYPE>#

Where to launch the child process, in a new kitty window in the current tab, a new tab, or a new os-window or an overlay over the current window. Note that if the current window already has an overlay, then it will open a new window. The value of background means the process will be run in the background. The values clipboard and primary are meant to work with --stdin-source to copy data to the system clipboard or primary selection. Default: window Choices: background, clipboard, os-window, overlay, primary, tab, window

--dont-take-focus, --keep-focus#

Keep the focus on the currently active window instead of switching to the newly opened window.

--cwd <CWD>#

The working directory for the newly launched child. Use the special value current to use the working directory of the currently active window. The special value last_reported uses the last working directory reported by the shell (needs Shell integration to work). The special value oldest works like current but uses the working directory of the oldest foreground process associated with the currently active window rather than the newest foreground process.

--env <ENV>#

Environment variables to set in the child process. Can be specified multiple times to set different environment variables. Syntax: name=value. Using name= will set to empty string and just name will remove the environment variable.

--hold#

Keep the window open even after the command being executed exits.

--copy-colors#

Set the colors of the newly created window to be the same as the colors in the currently active window.

--copy-cmdline#

Ignore any specified command line and instead use the command line from the currently active window.

--copy-env#

Copy the environment variables from the currently active window into the newly launched child process. Note that most shells only set environment variables for child processes, so this will only copy the environment variables that the shell process itself has, not the environment variables child processes inside the shell see. To copy that enviroment, use either the clone-in-kitty feature or the kitty remote control feature with kitty @ launch --copy-env.

--location <LOCATION>#

Where to place the newly created window when it is added to a tab which already has existing windows in it. after and before place the new window before or after the active window. neighbor is a synonym for after. Also applies to creating a new tab, where the value of after will cause the new tab to be placed next to the current tab instead of at the end. The values of vsplit, hsplit and split are only used by the splits layout and control if the new window is placed in a vertical, horizontal or automatic split with the currently active window. The default is to place the window in a layout dependent manner, typically, after the currently active window. Default: default Choices: after, before, default, first, hsplit, last, neighbor, split, vsplit

--allow-remote-control#

Programs running in this window can control kitty (even if remote control is not enabled in kitty.conf). Note that any program with the right level of permissions can still write to the pipes of any other program on the same computer and therefore can control kitty. It can, however, be useful to block programs running on other computers (for example, over SSH) or as other users.

--stdin-source <STDIN_SOURCE>#

Pass the screen contents as STDIN to the child process. @selection is the currently selected text. @screen is the contents of the currently active window. @screen_scrollback is the same as @screen, but includes the scrollback buffer as well. @alternate is the secondary screen of the current active window. For example if you run a full screen terminal application, the secondary screen will be the screen you return to when quitting the application. @first_cmd_output_on_screen is the output from the first command run in the shell on screen, @last_cmd_output is the output from the last command run in the shell, @last_visited_cmd_output is the first output below the last scrolled position via scroll_to_prompt, this three needs shell integration to work. Default: none Choices: @alternate, @alternate_scrollback, @first_cmd_output_on_screen, @last_cmd_output, @last_visited_cmd_output, @screen, @screen_scrollback, @selection, none

--stdin-add-formatting#

When using --stdin-source add formatting escape codes, without this only plain text will be sent.

--stdin-add-line-wrap-markers#

When using --stdin-source add a carriage return at every line wrap location (where long lines are wrapped at screen edges). This is useful if you want to pipe to program that wants to duplicate the screen layout of the screen.

--marker <MARKER>#

Create a marker that highlights text in the newly created window. The syntax is the same as for the toggle_marker action (see Mark text on screen).

--os-window-class <OS_WINDOW_CLASS>#

Set the WM_CLASS property on X11 and the application id property on Wayland for the newly created OS window when using --type=os-window. Defaults to whatever is used by the parent kitty process, which in turn defaults to kitty.

--os-window-name <OS_WINDOW_NAME>#

Set the WM_NAME property on X11 for the newly created OS Window when using --type=os-window. Defaults to --os-window-class.

--os-window-title <OS_WINDOW_TITLE>#

Set the title for the newly created OS window. This title will override any titles set by programs running in kitty. The special value current will use the title of the current OS window, if any.

Path to a PNG image to use as the logo for the newly created window. See window_logo_path.

--logo-position <LOGO_POSITION>#

The position for the window logo. Only takes effect if --logo is specified. See window_logo_position.

--logo-alpha <LOGO_ALPHA>#

The amount the window logo should be faded into the background. Only takes effect if --logo is specified. See window_logo_position. Default: -1

--color <COLOR>#

Change colors in the newly launched window. You can either specify a path to a .conf file with the same syntax as kitty.conf to read the colors from, or specify them individually, for example: --color background=white --color foreground=red.

--watcher <WATCHER>, -w <WATCHER>#

Path to a Python file. Appropriately named functions in this file will be called for various events, such as when the window is resized, focused or closed. See the section on watchers in the launch command documentation: Watching launched windows. Relative paths are resolved relative to the kitty config directory. Global watchers for all windows can be specified with watcher in kitty.conf.

kitty @ ls#

kitty @ ls [options]

List all windows. The list is returned as JSON tree. The top-level is a list of operating system kitty windows. Each OS window has an id and a list of tabs. Each tab has its own id, a title and a list of windows. Each window has an id, title, current working directory, process id (PID), command-line and environment of the process running in the window. Additionally, when running the command inside a kitty window, that window can be identified by the is_self parameter.

You can use these criteria to select windows/tabs for the other commands.

Options#

--all-env-vars#

Show all environment variables in output, not just differing ones.

kitty @ new-window#

kitty @ new-window [options] [CMD ...]

DEPRECATED: Use the launch command instead.

Open a new window in the specified tab. If you use the kitty @ new-window --match option the first matching tab is used. Otherwise the currently active tab is used. Prints out the id of the newly opened window (unless --no-response is used). Any command line arguments are assumed to be the command line used to run in the new window, if none are provided, the default shell is run. For example: kitty @ new-window --title Email mutt

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--title <TITLE>#

The title for the new window. By default it will use the title set by the program running in it.

--cwd <CWD>#

The initial working directory for the new window. Defaults to whatever the working directory for the kitty process you are talking to is.

--dont-take-focus, --keep-focus#

Keep the current window focused instead of switching to the newly opened window.

--window-type <WINDOW_TYPE>#

What kind of window to open. A kitty window or a top-level OS window. Default: kitty Choices: kitty, os

--new-tab#

Open a new tab.

--tab-title <TAB_TITLE>#

Set the title of the tab, when open a new tab.

--no-response#

Don’t wait for a response giving the id of the newly opened window. Note that using this option means that you will not be notified of failures and that the id of the new window will not be printed out. Default: false

kitty @ remove-marker#

kitty @ remove-marker [options]

Remove the currently set marker, if any.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--self#

Apply marker to the window this command is run in, rather than the active window.

kitty @ resize-os-window#

kitty @ resize-os-window [options]

Resize the specified OS Windows. Note that some window managers/environments do not allow applications to resize their windows, for example, tiling window managers.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--action <ACTION>#

The action to perform. Default: resize Choices: resize, toggle-fullscreen, toggle-maximized

--unit <UNIT>#

The unit in which to interpret specified sizes. Default: cells Choices: cells, pixels

--width <WIDTH>#

Change the width of the window. Zero leaves the width unchanged. Default: 0

--height <HEIGHT>#

Change the height of the window. Zero leaves the height unchanged. Default: 0

--incremental#

Treat the specified sizes as increments on the existing window size instead of absolute sizes.

--self#

Resize the window this command is run in, rather than the active window.

--no-response#

Don’t wait for a response indicating the success of the action. Note that using this option means that you will not be notified of failures. Default: false

kitty @ resize-window#

kitty @ resize-window [options]

Resize the specified windows in the current layout. Note that not all layouts can resize all windows in all directions.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--increment <INCREMENT>, -i <INCREMENT>#

The number of cells to change the size by, can be negative to decrease the size. Default: 2

--axis <AXIS>, -a <AXIS>#

The axis along which to resize. If horizontal, it will make the window wider or narrower by the specified increment. If vertical, it will make the window taller or shorter by the specified increment. The special value reset will reset the layout to its default configuration. Default: horizontal Choices: horizontal, reset, vertical

--self#

Resize the window this command is run in, rather than the active window.

kitty @ scroll-window#

kitty @ scroll-window [options] SCROLL_AMOUNT

Scroll the specified windows, if no window is specified, scroll the window this command is run inside. SCROLL_AMOUNT can be either the keywords start or end or an argument of the form <number>[unit][+-]. For example, 30 will scroll down 30 lines and 2p- will scroll up 2 pages. 3u will unscroll by 3 lines, which means that 3 lines will move from the scrollback buffer onto the top of the screen.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

kitty @ select-window#

kitty @ select-window [options] ...

Prints out the id of the selected window. Other commands can then be chained to make use of it.

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--response-timeout <RESPONSE_TIMEOUT>#

The time in seconds to wait for the user to select a window. Default: 60

--self#

Select window from the tab containing the window this command is run in, instead of the active tab.

--title <TITLE>#

A title that will be displayed to the user to describe what this selection is for.

--exclude-active#

Exclude the currently active window from the list of windows to pick.

--reactivate-prev-tab#

When the selection is finished, the tab in the same OS window that was activated before the selection will be reactivated. The last activated OS window will also be refocused.

kitty @ send-text#

kitty @ send-text [options] [TEXT TO SEND]

Send arbitrary text to specified windows. The text follows Python escaping rules. So you can use escapes like x1b to send control codes and u21fa to send unicode characters. If you use the kitty @ send-text --match option the text will be sent to all matched windows. By default, text is sent to only the currently active window.

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--match-tab <MATCH_TAB>, -t <MATCH_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--all#

Match all windows.

--exclude-active#

Do not send text to the active window, even if it is one of the matched windows.

--stdin#

Read the text to be sent from stdin. Note that in this case the text is sent as is, not interpreted for escapes. If stdin is a terminal, you can press Ctrl+D to end reading.

--from-file <FROM_FILE>#

Path to a file whose contents you wish to send. Note that in this case the file contents are sent as is, not interpreted for escapes.

kitty @ set-background-image#

kitty @ set-background-image [options] PATH_TO_PNG_IMAGE

Set the background image for the specified OS windows. You must specify the path to a PNG image that will be used as the background. If you specify the special value none then any existing image will be removed.

Options#

--all, -a#

By default, background image is only changed for the currently active OS window. This option will cause the image to be changed in all windows.

--configured, -c#

Change the configured background image which is used for new OS windows.

--layout <LAYOUT>#

How the image should be displayed. A value of configured will use the configured value. Choices: clamped, configured, mirror-tiled, scaled, tiled

--no-response#

Don’t wait for a response from kitty. This means that even if setting the background image failed, the command will exit with a success code. Default: false

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

kitty @ set-background-opacity#

kitty @ set-background-opacity [options] OPACITY

Set the background opacity for the specified windows. This will only work if you have turned on dynamic_background_opacity in kitty.conf. The background opacity affects all kitty windows in a single OS window. For example: kitty @ set-background-opacity 0.5

Options#

--all, -a#

By default, background opacity are only changed for the currently active window. This option will cause background opacity to be changed in all windows.

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--match-tab <MATCH_TAB>, -t <MATCH_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ set-colors#

kitty @ set-colors [options] COLOR_OR_FILE ...

Set the terminal colors for the specified windows/tabs (defaults to active window). You can either specify the path to a conf file (in the same format as kitty.conf) to read the colors from or you can specify individual colors, for example: kitty @ set-colors foreground=red background=white

Options#

--all, -a#

By default, colors are only changed for the currently active window. This option will cause colors to be changed in all windows.

--configured, -c#

Also change the configured colors (i.e. the colors kitty will use for new windows or after a reset).

--reset#

Restore all colors to the values they had at kitty startup. Note that if you specify this option, any color arguments are ignored and kitty @ set-colors --configured and kitty @ set-colors --all are implied.

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--match-tab <MATCH_TAB>, -t <MATCH_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ set-enabled-layouts#

kitty @ set-enabled-layouts [options] LAYOUTS

Set the enabled layouts in the specified tabs (or the active tab if not specified). You can use special match value all to set the enabled layouts in all tabs. If the current layout of the tab is not included in the enabled layouts, its layout is changed to the first enabled layout.

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--configured#

Change the default enabled layout value so that the new value takes effect for all newly created tabs as well.

kitty @ set-font-size#

kitty @ set-font-size [options] FONT_SIZE

Sets the font size to the specified size, in pts. Note that in kitty all sub-windows in the same OS window must have the same font size. A value of zero resets the font size to default. Prefixing the value with a + or - increments the font size by the specified amount.

Options#

--all, -a#

By default, the font size is only changed in the active OS window, this option will cause it to be changed in all OS windows. It also changes the font size for any newly created OS Windows in the future.

kitty @ set-spacing#

kitty @ set-spacing [options] MARGIN_OR_PADDING ...

Set the paddings and margins for the specified windows (defaults to active window). For example: margin=20 or padding-left=10 or margin-h=30. The shorthand form sets all values, the *-h and *-v variants set horizontal and vertical values. The special value default resets to using the default value. If you specify a tab rather than a window, all windows in that tab are affected.

Options#

--all, -a#

By default, settings are only changed for the currently active window. This option will cause paddings and margins to be changed in all windows.

--configured, -c#

Also change the configured paddings and margins (i.e. the settings kitty will use for new windows).

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

--match-tab <MATCH_TAB>, -t <MATCH_TAB>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ set-tab-color#

kitty @ set-tab-color [options] COLORS

Change the color of the specified tabs in the tab bar

The foreground and background colors when active and inactive can be overridden using this command. The syntax for specifying colors is: active_fg=color active_bg=color inactive_fg=color inactive_bg=color. Where color can be either a color name or a value of the form #rrggbb or the keyword NONE to revert to using the default colors.

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

--self#

Close the tab this command is run in, rather than the active tab.

kitty @ set-tab-title#

kitty @ set-tab-title [options] TITLE ...

Set the title for the specified tabs. If you use the kitty @ set-tab-title --match option the title will be set for all matched tabs. By default, only the tab in which the command is run is affected. If you do not specify a title, the title of the currently active window in the tab is used.

Options#

--match <MATCH>, -m <MATCH>#

The tab to match. Match specifications are of the form: field:query. Where field can be one of: id, index, title, window_id, window_title, pid, cwd, cmdline env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all tabs.

For numeric fields: id, index, window_id, pid and recent, the expression is interpreted as a number, not a regular expression.

When using title or id, first a matching tab is looked for, and if not found a matching window is looked for, and the tab for that window is used.

You can also use window_id and window_title to match the tab that contains the window with the specified id or title.

The index number is used to match the nth tab in the currently active OS window. The recent number matches recently active tabs in the currently active OS window, with zero being the currently active tab, one the previously active tab and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2. Tabs containing any window with the specified environment variables are matched.

The field state matches on the state of the tab. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active tabs are the tabs that are active in their parent OS window. There is only one focused tab and it is the tab to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of tabs.

kitty @ set-window-title#

kitty @ set-window-title [options] [TITLE ...]

Set the title for the specified windows. If you use the kitty @ set-window-title --match option the title will be set for all matched windows. By default, only the window in which the command is run is affected. If you do not specify a title, the last title set by the child process running in the window will be used.

Options#

--temporary#

By default, the title will be permanently changed and programs running in the window will not be able to change it again. If you want to allow other programs to change it afterwards, use this option.

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.

kitty @ signal-child#

kitty @ signal-child [options] [SIGNAL_NAME ...]

Send one or more signals to the foreground process in the specified windows. If you use the kitty @ signal-child --match option the signal will be sent for all matched windows. By default, only the active window is affected. If you do not specify any signals, SIGINT is sent by default. You can also map this to a shortcut in kitty.conf, for example:

map f1 signal_child SIGTERM

Options#

--match <MATCH>, -m <MATCH>#

The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, state and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.

The special value all matches all windows.

For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression.

The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitty @ ls command).

The window id of the current window is available as the KITTY_WINDOW_ID environment variable.

The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.

When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.

The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active and parent_focused. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered.

Note that you can use the kitty @ ls command to get a list of windows.