Skip to content

v0.69.0 - Safe Server contexts, user-option strings, and empty fields

Latest

Choose a tag to compare

@tony tony released this 28 Nov 00:47

libtmux 0.69.0 leaves a running Server alive when exiting with Server() as server: unless kill_on_exit=True is set, preserves @ user-option values as strings in show_option() and show_options(), and hydrates empty tmux format fields on Session, Window, Pane, and Client as "" rather than None.

Highlights

  • Scoping a Server preserves the running daemon. Leaving with Server() as server: previously killed whichever tmux server used that socket — including the default server and every session in it. Leaving the block now preserves the server on both normal and raising exits. Pass kill_on_exit=True when constructing a disposable server you want torn down on exit, or call Server.kill() directly. Session, Window, and Pane context managers retain their existing teardown behavior (#728; see Context managers).
  • @ user options return strings. tmux stores every @ user option as a string, whereas show_option() and show_options() previously coerced values such as "123", "007", "on", and "off" into integers or booleans and stripped escapes on multiline or tab-containing values. Both methods now return the stored string verbatim across server, session, window, and pane scopes (including inherited @name* reads via show_option("@name", include_inherited=True)), while built-in options keep their numeric, boolean, and structured conversions (#826; see Options and hooks).
  • Empty tmux format fields read as "". Fields that tmux reports as empty — such as a cleared Pane.pane_title or an unset Session.session_group — now hydrate as "" on initial queries and after refresh(). None is reserved for format tokens that the listing command or running tmux version did not request (#900).

Upgrading

Opt into server teardown on exit when creating a throwaway socket:

with Server(socket_name="ci-build", kill_on_exit=True) as server:
    server.new_session(session_name="runner")

Convert @ user-option values explicitly when your application stores numbers or booleans:

retries = int(session.show_option("@retries"))
enabled = session.show_option("@enabled") == "on"

Check empty string fields with truthiness rather than is None:

if not pane.pane_title:
    pane.set_title("worker")

See the migration notes and the changelog for the full list.

What's Changed

  • Scoping a Server no longer kills it by @tony in #728
  • neo(fix[parse_output]): Keep empty tmux fields as empty strings by @tony in #900
  • options(fix): Preserve user-option strings by @tony in #826

Full Changelog: v0.68.0...v0.69.0