v0.68.0 - Raise on closed panes, reuse windows by index2026-11-25
libtmux 0.68.0 raises TmuxObjectDoesNotExist when a pane, window or session has closed, instead of returning [] from Pane.capturepane() or None from Pane.sendkeys(). Server.runshell() raises VersionTooLow on tmux 3.3a and 3.4 rather than returning [] when tmux leaves the output in copy mode, Session.newwindow() with selectexisting=True reuses an existing window by index or target on every tmux, and expandformats is the one parameter name for tmux's -F.
Highlights
- Closed panes, windows and sessions raise TmuxObjectDoesNotExist. Pane.capturepane() and Pane.sendkeys() previously returned [] and None when their pane had closed, and methods that already raised for a missing session, window or pane raised the base LibTmuxException. They now raise TmuxObjectDoesNotExist, a LibTmuxException subclass so except LibTmuxException still matches. send_keys() and Pane.enter() also raise LibTmuxException on other tmux errors (#902).
- runshell() raises VersionTooLow on tmux 3.3a and 3.4 instead of returning []. On tmux 3.3a and 3.4, a foreground run-shell leaves its output in copy mode and sends nothing back to the caller. Server.runshell() now raises VersionTooLow there; calls with background=True, astmuxcommand=True or target_pane= run as before (#918).
- selectexisting=True reuses by index or target on every tmux. Session.newwindow() looks up the window at windowindex or targetwindow itself instead of sending new-window -S, so reuse returns the existing Window instead of raising IndexError or failing with "index in use" on tmux 3.3a through 3.7. Passing windowname alongside an index or window ID raises LibTmuxException when the window there has another name, and combining selectexisting=True with kill_existing=True raises ValueError (#827). Entering with on a reused Window still kills it on exit (#926; see Context managers), and Format("#{command}") never matches an existing window because the lookup expands it with display-message while tmux names the window new-window (#921; see Literal text and tmux formats).
- expandformats is the one name for tmux's -F. Session.setenvironment(), Server.commandprompt() and Session.setoption() (along with server, window and pane setoption()) take expandformats, the same name Pane.sendkeys() uses. expandformat and _format still work and emit DeprecationWarning (#919).
To handle panes that may close before capture:
``python
from libtmux import exc
try:
lines = pane.capture_pane()
except exc.TmuxObjectDoesNotExist:
lines = []
`
See the migration notes and the changelog for the full list.
What's Changed
Session(docs[newwindow]): Note the #{command} lookup limit by @tony in https://github.com/tmux-python/libtmux/pull/921
* tests(Session,Window): Wait for the shell before reading env output by @tony in https://github.com/tmux-python/libtmux/pull/922
libtmux(feat[expandformats]): One name for -F by @tony in https://github.com/tmux-python/libtmux/pull/919
Server(fix[runshell]): Refuse output tmux keeps by @tony in https://github.com/tmux-python/libtmux/pull/918
Session(fix[newwindow]): Reuse by index or target on every tmux by @tony in https://github.com/tmux-python/libtmux/pull/827
* tmux(fix[errors]): Raise TmuxObjectDoesNotExist for a closed target by @tony in https://github.com/tmux-python/libtmux/pull/902
Session(docs[newwindow]): Note Window.exit on select_existing` reuse by @tony in https://github.com/tmux-python/libtmux/pull/926
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.67.1...v0.68.0
v0.67.1 - select_existing finds literal names2026-11-23
libtmux 0.67.1 fixes Session.newwindow() with selectexisting=True, which now finds a window by its literal name on every tmux and returns it instead of raising IndexError, and the format guide now says what a format can run.
Highlights
- selectexisting=True finds a literal name on every tmux. libtmux now looks the window name up itself instead of relying on tmux's new-window -S, which matches a name differently per release: tmux 3.3a compared the escaped name, so a name containing #, %, , or } created a duplicate window, and tmux 3.7 and later expanded it a second time, so a name like #{sessionname} could select another window. A Format name is expanded once against the session, then looked up. The existing window is returned and selected only with attach=True, and two windows with the name raise LibTmuxException. With windowindex or targetwindow, tmux's -S still decides (#917).
- The format guide says what a format can run. A Format hands its text to tmux's format language, which runs #(...) as a shell command and expands an option's value again through E: and T:. The guide now says so, and that a plain str from a user passed to an argument tmux always expands, such as display_message, runs any #(...) it contains; Format.escape() shows such text exactly (#915).
Two limits of the selectexisting lookup: the lookup and the creation are separate tmux commands, so two callers can both create the window, and a name containing a backslash is not found once tmux stores it escaped (after renamewindow, and for any new window from tmux 3.7).
See Literal text and tmux formats and the changelog for details.
What's Changed
* docs(formats): Say what a format can run by @tony in https://github.com/tmux-python/libtmux/pull/915
Session(fix[newwindow]): Look up reuse by name by @tony in https://github.com/tmux-python/libtmux/pull/917
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.67.0...v0.67.1
v0.67.0 - Literal names and the Format opt-in2026-11-23
libtmux 0.67.0 keeps a # in session names, window names, pane titles, start directories and buffer paths as typed, where tmux used to expand it as a format, and adds Format to have tmux expand one value on purpose. Server.newsession() with killsession=True kills only the exactly named session, and exact=True matches a session name exactly in killsession(), switchclient() and attach_session().
Highlights
- # is literal in names, titles, start directories and buffer paths. renamewindow("build#2") names the window build#2, and renamewindow("#S") names it #S rather than the session's name. This covers newsession, newwindow, renamesession, renamewindow, settitle, split, newpane, the respawn methods, displaypopup's start directory and title, displaymenu's title, the paths of savebuffer and loadbuffer, and run_shell's cwd on tmux 3.8, the first release that expands it (#901, #910).
- Format opts one value into tmux's formats. pane.split(startdirectory=Format("#{panecurrent_path}")) opens a pane in the active pane's directory again. Each argument decides for itself, so one call can keep its name literal while expanding its start directory. +, join and Format.escape() add text from users or files and keep it literal, and adding plain text where tmux would read it as format syntax raises ValueError. Parameters that accept a format are typed str | Format, so a type checker flags a Format where tmux would store it as typed (#910).
- newsession(killsession=True) kills only the exactly named session. Creating doom with kill_session=True no longer removes doomsday (#899).
- exact= for session names. killsession, switchclient and attach_session accept exact=True to match a name exactly; without it they still match by prefix or pattern as tmux does, and warn when the name matched only that way (#899).
To keep tmux's expansion where you relied on it:
``python
from libtmux import Format
pane.split(startdirectory=Format("#{panecurrent_path}"))
window.renamewindow(Format("#{panecurrent_command}"))
``
See Literal text and tmux formats for which arguments are literal and how to opt in, and the changelog for the full list.
What's Changed
Server(feat[killsession]): Add exact= to match session names exactly by @tony in https://github.com/tmux-python/libtmux/pull/899
* tmux(fix[formats]): Keep # literal in names, titles and directories by @tony in https://github.com/tmux-python/libtmux/pull/901
* formats(feat[Format]): Opt into tmux formats by @tony in https://github.com/tmux-python/libtmux/pull/910
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.66.0...v0.67.0
v0.66.0 - Owner-only save_buffer and hex keys without Enter2026-11-22
libtmux 0.66.0 makes two narrow breaking changes: files Server.savebuffer() creates are readable by their owner only, and Pane.sendkeys() with hex_keys=True no longer adds Enter. A socket path too long for tmux now raises SocketPathTooLong, saying how far over the limit it is and where the length came from.
Highlights
- Owner-only savebuffer files. A new file Server.savebuffer() writes is readable and writable by its owner only. It used to follow the process umask, so saved scrollback and paste buffers were usually readable by every local user. A file that already exists keeps its permissions; call path.chmod(0o644) after saving to share a new one (#903).
- Hex keys without Enter. Pane.sendkeys(..., hexkeys=True) sends only the bytes you give it, so an escape sequence or partial keystroke no longer runs the line. Pass enter=True to keep the old behaviour. Calls without hex_keys still send Enter by default, and enter=False and enter=None mean what they did (#904).
- SocketPathTooLong. A socket path too long for a UNIX socket raises SocketPathTooLong, a LibTmuxException, in place of tmux's bare File name too long. An explicit socketpath is checked when the Server is created and a socketname when a command runs; Server.is_alive() still returns False instead of raising (#730).
See the changelog for the full list.
What's Changed
* Measure a tmux socket path where tmux resolves it by @tony in https://github.com/tmux-python/libtmux/pull/730
Server(fix[savebuffer]): Create the saved file owner-only by @tony in https://github.com/tmux-python/libtmux/pull/903
Pane(fix[sendkeys]): Send hex keys without a trailing Enter by @tony in https://github.com/tmux-python/libtmux/pull/904
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.65.0...v0.66.0
v0.65.0 - Capability matrix and tmux 3.3a minimum2026-11-22
libtmux 0.65.0 adds a capability matrix to the compatibility page: which tmux release each gated feature needs, the methods it affects, and what libtmux does on an older tmux. It also raises the minimum tmux to 3.3a, the release's one breaking change; stay on libtmux 0.64.x to keep using tmux 3.2a.
Highlights
- Capability matrix. The compatibility page lists each tmux feature libtmux gates by release, from the run-shell working directory (tmux 3.4) to floating panes (tmux 3.7), with the Python methods each one affects and whether an older tmux warns and falls back or raises LibTmuxException. The matrix is generated from the same table the runtime gates read, and the repository publishes it as capabilities.json, keyed by capability ids shared with the other libtmux ports. The gates behave as before (#887).
- tmux 3.3a is the minimum. libtmux 0.64.0 is the last release that supports tmux 3.2a. Server.serveraccess(), confirmbefore(), commandprompt(), showprompthistory(), clearprompthistory() and Pane.displaypopup() no longer check for tmux 3.3 before running (#888).
See the changelog for the full list.
What's Changed
* Capabilities(feat): Gate tmux features from one table by @tony in https://github.com/tmux-python/libtmux/pull/887
* tmux(feat[minimum]): Require tmux 3.3a by @tony in https://github.com/tmux-python/libtmux/pull/888
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.64.0...v0.65.0
v0.64.0 - Target and argument fixes2026-11-22
libtmux 0.64.0 是纯修复版本,没有破坏性变更,可以放心升级或锁定版本。
这版重点解决了「调用串台」的问题:Window.selectpane(1) 不再误改其他会话的活动窗格,Session.killwindow("name") 也不会再杀掉别的会话里同名的窗口。参数传递也更严谨了——以 - 开头的值(如 renamewindow("-n"))会被当作数据而非标志位;以 ; 结尾的值不再触发后续 tmux 命令,此前 setoption("mouse;", "kill-server", global_=True) 会直接关掉服务器,现在不会了。
列表查询更健壮:窗格当前目录含换行符时,Server.panes 和 Server.windows 不再抛 ValueError。日志方面,tmux 命令行中的环境变量值会以 ` 遮蔽。retryuntil() 现在支持向谓词传递 args=,并改用单调时钟计时。
其他修复包括:sendkeys(hexkeys=True) 逐字节发送、refresh() 正确清空 tmux 已置空的字段、repr(Server()) 显示实际使用的 socket、sys.stdout 无 encoding 时也能正常 import libtmux`,以及查找异常的子类类型检查。
v0.63.0 - Python 3.11 floor, tmux 3.8 fixes2026-11-22
libtmux 0.63.0 把最低 Python 版本提高到 3.11,同时跟进 tmux 3.8 的变化。0.62.0 是最后一个支持 Python 3.10 的版本,该版本已于 2026 年 10 月停止维护;在 3.10 环境下 pip 会继续安装 0.62.0。
Pane.break_pane() 现在会返回目标窗口:当拆出的是窗口里唯一的 pane 时,即使 pane 已被其他客户端移走,也能拿到正确的 Window 对象。此前在 tmux 3.2a 到 3.5 上,移动成功后可能抛出 IndexError。
showhook() 能读取 tmux 3.8 新增的钩子(如 pane-created、window-zoomed),并保留其稀疏索引;displaypopup() 在 tmux 3.8 上执行命令时需要一个终端客户端。
文档方面,Server、Session、Window、Pane 的类页面按任务重新组织了方法说明,注明每个调用的返回值与异常;选项类、钩子表和 format 对象的每个字段也补上了 tmux 手册中的描述。
v0.62.0 - Locate yourself, resolve linked windows2026-07-13
libtmux 0.62.0 让对象学会「自我定位」,并按 tmux 自身的规则解析共享窗口。运行在 tmux 内部的代码现在可用 Pane.fromenv()、Server.fromenv() 等方法直接找到自己所在的 pane、窗口或会话,无需先持有句柄;不在 tmux 内或环境无法解析时抛出 NotInsideTmux,不作猜测。新增 Window.linkedsessions 可列出窗口被链接到的所有会话。Window.fromwindowid()、Pane.frompaneid() 及两者的 refresh() 此前会随机选一个持有会话,改名后结果可能变化,现在交由 tmux 决定,windowindex 也取 tmux 会选的索引。QueryList.get() 的报错信息会写明查询条件与结果,如 No objects found: pane_id='%99'。
⚠️ 破坏性变更:ObjectDoesNotExist 与 MultipleObjectsReturned 现在继承自 LibTmuxException。若同时捕获两类异常,需按从具体到一般的顺序排列,否则宽泛的 LibTmuxException 会拦截查找结果;针对 LibTmuxException 的整体重试策略也应排除这两者——它们表示确定性的查找失败,而非 tmux 的临时故障。
v0.61.0 - tmux 3.7a and 3.7b test fixes2026-07-04
libtmux 0.61.0 hardens support for the tmux 3.7 patch line. It fixes Pane.breakpane() naming broken-out windows libtmux instead of tmux's own default on tmux 3.7a/3.7b, and adds getversion_str() for reading the raw tmux version with its point-release suffix intact.
Highlights
- Fix — breakpane() keeps tmux's default window name on 3.7a/3.7b (#699). Breaking a pane into a new window without an explicit windowname left it named libtmux on tmux 3.7a/3.7b; it now keeps tmux's own default (typically the running command). Passing window_name is unaffected.
- New — getversionstr() (#699). libtmux.common.getversionstr() returns the running tmux version verbatim, keeping the point-release suffix ("3.7a") that get_version() strips for numeric comparison — useful for telling patch releases apart, e.g. 3.7 from 3.7a.
- tmux 3.7a/3.7b test compatibility (#698). The test suite now passes against tmux 3.7a and 3.7b, which CI also exercises.
What's Changed
* docs: lead topic pages with the concept, add docs voice guide by @tony in https://github.com/tmux-python/libtmux/pull/696
* Fix window-name test for tmux 3.7a/3.7b and add them to CI by @tony in https://github.com/tmux-python/libtmux/pull/698
Fix breakpane forcing 'libtmux' window name on tmux 3.7a/3.7b by @tony in https://github.com/tmux-python/libtmux/pull/699
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.60.0...v0.61.0
v0.60.0 - tmux 3.7 parity2026-06-29
libtmux 0.60.0 completes tmux 3.7 feature parity. Building on the 3.7 compatibility shipped in 0.59.0, it adds first-class floating panes via Pane.newpane() and Window.newpane(), types tmux 3.7's new server, session, window, and pane options, exposes the new pane format variables on Pane, and wraps tmux 3.7's new command flags. Every 3.7-only surface is version-gated, so tmux 3.2a–3.6 keep working unchanged.
What's new
Floating panes (new-pane) (#694)
tmux 3.7's flagship feature is now reachable through Window.newpane() and Pane.newpane(). A floating pane sits above the tiled layout like a popup but behaves like a real pane. Pass width/height to size it and x/y to position it, alongside the usual shell, startdirectory, environment, zoom, and empty, plus style, activeborderstyle, inactiveborderstyle, message, and keep (remain-on-exit). The returned Pane reports panefloating_flag == "1". Requires tmux 3.7+; see the floating panes guide.
Typed tmux 3.7 options (#694)
The option dataclasses now type tmux 3.7's new options. On the server, get-clipboard; on the session, focus-follows-mouse, message-format, and prompt-command-cursor-style; and on the window, the copy-mode line-number options, the tree-mode preview options, and the window-pane status formats (of these, tree-mode-preview-format is also pane-scoped). The pane remain-on-exit option gained tmux 3.7's key value, and pane-active-border-style / pane-border-style (widened to pane scope in 3.7) now type on the pane too.
tmux 3.7 pane format variables (#694)
Pane now exposes tmux 3.7's new pane format variables: the floating-pane geometry and flags (panefloatingflag, panex, paney, panez, paneflags, panezoomedflag), the OSC 9;4 progress report (panepbprogress, panepbstate), panepipepid, and the bracketpasteflag and synchronizedoutputflag screen-mode flags. Each is version-gated, so the format template stays clean on tmux 3.2a–3.6.
tmux 3.7 command flags (#694)
New tmux 3.7 flags are exposed on existing wrappers: Pane.capturepane() gains hyperlinks (-H), linenumbers (-L), and lineflags (-F); Window.split() / Pane.split() gain empty (-E) plus style/activeborderstyle/inactiveborderstyle (-s/-S/-R), message (-m), and keep (-k); Session.kill() gains group (-g); and Pane.pastebuffer() gains novis (-S). On the server, Server.commandprompt() gains nofreeze (-C), Server.listkeys() gains format (-F), Server.runshell() accepts trailing args expanded as #{1}/#{2}, and Server.refreshclient() gains requestclipboard (-l). Each warns and is ignored on tmux < 3.7.
Compatibility
Purely additive — no breaking changes. New 3.7 parameters are gated on tmux's reported version; unsupported flags warn and are ignored on older tmux, and floating-pane creation raises there because new-pane does not exist before 3.7. tmux 3.2a–3.6 remain supported and tested.
Links: Changelog · API docs · Floating panes guide · PyPI
What's Changed
* Add tmux 3.7 feature parity: floating panes, options, formats by @tony in https://github.com/tmux-python/libtmux/pull/694
Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.59.0...v0.60.0