libtmux Reference MCP Search
On this page

window.Window.kill

View as Markdown

Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
Other languages
PythonTypeScriptGoJava.NETC++Swift
kill ( self ) Result<(), Error>
method [source]
method [source]
kill

Kill the window, closing it in every session that links it.

This consumes the handle. Use Window::unlink to remove only this session's link while leaving the window alive elsewhere.

Errors

Returns an error when tmux refuses the command.

In other languages Close a window

Examples

Kill a window:

>>> window_1 = session.new_window()
>>> window_1 in session.windows
True
>>> window_1.kill()
>>> window_1 not in session.windows
True

Kill all windows except the current one:

>>> one_window_to_rule_them_all = session.new_window()
>>> other_windows = session.new_window(
...     ), session.new_window()
>>> all([w in session.windows for w in other_windows])
True
>>> one_window_to_rule_them_all.kill(all_except=True)
>>> all([w not in session.windows for w in other_windows])
True
>>> one_window_to_rule_them_all in session.windows
True
await window.kill();

0 declared, 0 inherited

Esc

Type to search.