Skip to content

libtmux v0.31.0 #912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force

<!-- Maintainers, insert changes / features for the next release here -->

#### Breaking changes

- libtmux: 0.30.2 -> 0.31.0 (#912)

- Renamings of libtmux 0.31.0's streamlining of `cmd()`, renaming of `attached_{window,pane}s` to
`active_{window,pane}s`.

## tmuxp 1.38.0 (2024-02-16)

#### Breaking changes

- libtmux: 0.28.1 -> 0.30.1 (#911).
- libtmux: 0.28.1 -> 0.30.1 (#911)

Updated method names

Expand Down
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def add_doctest_fixtures(
doctest_namespace["server"] = request.getfixturevalue("server")
session: "Session" = request.getfixturevalue("session")
doctest_namespace["session"] = session
doctest_namespace["window"] = session.attached_window
doctest_namespace["pane"] = session.attached_pane
doctest_namespace["window"] = session.active_window
doctest_namespace["pane"] = session.active_pane
doctest_namespace["test_utils"] = test_utils
doctest_namespace["tmp_path"] = tmp_path
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tmuxp = 'tmuxp:cli.cli'

[tool.poetry.dependencies]
python = "^3.8"
libtmux = "~0.30.1"
libtmux = "~0.31.0"
colorama = ">=0.3.9"
PyYAML = "^6.0"

Expand Down
7 changes: 4 additions & 3 deletions src/tmuxp/cli/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ def set_layout_hook(session: Session, hook_name: str) -> None:
hook_name : str
hook name to bind to, e.g. 'client-attached'
"""
cmd = ["set-hook", "-t", session.id, hook_name]
assert session.id is not None
cmd: t.List[str] = ["set-hook", "-t", str(session.id), hook_name]
hook_cmd = []
attached_window = session.attached_window
active_window = session.active_window
for window in session.windows:
# unfortunately, select-layout won't work unless
# we've literally selected the window at least once
Expand All @@ -92,7 +93,7 @@ def set_layout_hook(session: Session, hook_name: str) -> None:

# unset the hook immediately after executing
hook_cmd.append(f"set-hook -u -t {session.id} {hook_name}")
hook_cmd.append(f"selectw -t {attached_window.id}")
hook_cmd.append(f"selectw -t {active_window.id}")

# join the hook's commands with semicolons
_hook_cmd = "{}".format("; ".join(hook_cmd))
Expand Down
4 changes: 2 additions & 2 deletions src/tmuxp/cli/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def command_shell(

- session_name and window_name arguments
- current shell: envvar ``TMUX_PANE`` for determining window and session
- :attr:`libtmux.Server.attached_sessions`, :attr:`libtmux.Session.attached_window`,
:attr:`libtmux.Window.attached_pane`
- :attr:`libtmux.Server.attached_sessions`, :attr:`libtmux.Session.active_window`,
:attr:`libtmux.Window.active_pane`
"""
# If inside a server, detect socket_path
env_tmux = os.getenv("TMUX")
Expand Down
2 changes: 1 addition & 1 deletion src/tmuxp/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def get_pane(window: "Window", current_pane: t.Optional["Pane"] = None) -> "Pane
if current_pane is not None:
pane = window.panes.get(pane_id=current_pane.pane_id)
else:
pane = window.attached_pane
pane = window.active_pane
except exc.TmuxpException as e:
print(e)

Expand Down
6 changes: 3 additions & 3 deletions src/tmuxp/workspace/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def iter_create_windows(

w1 = None
if is_first_window_pass: # if first window, use window 1
w1 = session.attached_window
w1 = session.active_window
w1.move_window("99")

start_directory = window_config.get("start_directory", None)
Expand Down Expand Up @@ -403,7 +403,7 @@ def iter_create_windows(
assert isinstance(window, Window)

if is_first_window_pass: # if first window, use window 1
session.attached_window.kill()
session.active_window.kill()

if "options" in window_config and isinstance(
window_config["options"],
Expand Down Expand Up @@ -452,7 +452,7 @@ def iter_create_panes(
start=pane_base_index,
):
if pane_index == int(pane_base_index):
pane = window.attached_pane
pane = window.active_pane
else:

def get_pane_start_directory(
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def test_load_symlinked_workspace(
detached=True,
)
assert session is not None
assert session.attached_window is not None
pane = session.attached_window.attached_pane
assert session.active_window is not None
pane = session.active_window.active_pane

assert isinstance(session, Session)
assert session.name == "samplesimple"
Expand Down
8 changes: 4 additions & 4 deletions tests/cli/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def test_shell(
window = session.new_window(window_name=window_name)
window.split_window()

assert window.attached_pane is not None
assert window.active_pane is not None

template_ctx = {
"SOCKET_NAME": server.socket_name,
"SESSION_NAME": session.name,
"WINDOW_NAME": window_name,
"PANE_ID": window.attached_pane.id,
"PANE_ID": window.active_pane.id,
"SERVER_SOCKET_NAME": server.socket_name,
}

Expand Down Expand Up @@ -293,13 +293,13 @@ def test_shell_interactive(
window = session.new_window(window_name=window_name)
window.split_window()

assert window.attached_pane is not None
assert window.active_pane is not None

template_ctx = {
"SOCKET_NAME": server.socket_name,
"SESSION_NAME": session.name,
"WINDOW_NAME": window_name,
"PANE_ID": window.attached_pane.id,
"PANE_ID": window.active_pane.id,
"SERVER_SOCKET_NAME": server.socket_name,
}

Expand Down
24 changes: 12 additions & 12 deletions tests/workspace/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def test_focus_pane_index(session: Session) -> None:

builder.build(session=session)

assert session.attached_window.name == "focused window"
assert session.active_window.name == "focused window"

_pane_base_index = session.attached_window.show_window_option(
_pane_base_index = session.active_window.show_window_option(
"pane-base-index",
g=True,
)
Expand All @@ -106,14 +106,14 @@ def test_focus_pane_index(session: Session) -> None:
# get the pane index for each pane
pane_base_indexes = [
int(pane.index)
for pane in session.attached_window.panes
for pane in session.active_window.panes
if pane is not None and pane.index is not None
]

pane_indexes_should_be = [pane_base_index + x for x in range(0, 3)]
assert pane_indexes_should_be == pane_base_indexes

w = session.attached_window
w = session.active_window

assert w.name != "man"

Expand All @@ -122,7 +122,7 @@ def test_focus_pane_index(session: Session) -> None:

def f_check() -> bool:
nonlocal p
p = w.attached_pane
p = w.active_pane
assert p is not None
return p.pane_current_path == pane_path

Expand All @@ -142,7 +142,7 @@ def f_check() -> bool:

def f_check_again() -> bool:
nonlocal p
p = window3.attached_pane
p = window3.active_pane
assert p is not None
return p.pane_current_path == pane_path

Expand Down Expand Up @@ -188,7 +188,7 @@ def assertIsMissing(cmd: str, hist: str) -> bool:
]:
assert w.name == window_name
w.select()
p = w.attached_pane
p = w.active_pane
assert p is not None
p.select()

Expand Down Expand Up @@ -279,7 +279,7 @@ def test_global_session_env_options(
assert isinstance(_visual_silence, str)
assert visual_silence in _visual_silence
assert repeat_time == session.show_option("repeat-time")
assert main_pane_height == session.attached_window.show_window_option(
assert main_pane_height == session.active_window.show_window_option(
"main-pane-height",
)

Expand Down Expand Up @@ -338,7 +338,7 @@ def f() -> bool:
# Print output for easier debugging if assertion fails
return retry_until(f, raises=False)

for i, pane in enumerate(session.attached_window.panes):
for i, pane in enumerate(session.active_window.panes):
assert assert_last_line(pane, str(i)), (
"Initial command did not execute properly/" + str(i)
)
Expand All @@ -351,7 +351,7 @@ def f() -> bool:
session.cmd("send-keys", " echo moo")
session.cmd("send-keys", "Enter")

for pane in session.attached_window.panes:
for pane in session.active_window.panes:
assert assert_last_line(
pane,
"moo",
Expand Down Expand Up @@ -1235,7 +1235,7 @@ def test_load_workspace_enter(

session = builder.session
assert isinstance(session, Session)
pane = session.attached_pane
pane = session.active_pane
assert isinstance(pane, Pane)

def fn() -> bool:
Expand Down Expand Up @@ -1363,7 +1363,7 @@ def test_load_workspace_sleep(
session = builder.session
assert isinstance(builder.session, Session)
assert session is not None
pane = session.attached_pane
pane = session.active_pane
assert isinstance(pane, Pane)

assert pane is not None
Expand Down