Skip to content

Commit 659f896

Browse files
authored
py(deps),refactor: libtmux v0.31.0 (#912)
See also: - https://libtmux.git-pull.com/history.html#libtmux-0-31-0-2024-02-17
2 parents 69bd8cc + 261fd5e commit 659f896

File tree

11 files changed

+43
-35
lines changed

11 files changed

+43
-35
lines changed

CHANGES

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,18 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force
1919

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

22+
#### Breaking changes
23+
24+
- libtmux: 0.30.2 -> 0.31.0 (#912)
25+
26+
- Renamings of libtmux 0.31.0's streamlining of `cmd()`, renaming of `attached_{window,pane}s` to
27+
`active_{window,pane}s`.
28+
2229
## tmuxp 1.38.0 (2024-02-16)
2330

2431
#### Breaking changes
2532

26-
- libtmux: 0.28.1 -> 0.30.1 (#911).
33+
- libtmux: 0.28.1 -> 0.30.1 (#911)
2734

2835
Updated method names
2936

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def add_doctest_fixtures(
107107
doctest_namespace["server"] = request.getfixturevalue("server")
108108
session: "Session" = request.getfixturevalue("session")
109109
doctest_namespace["session"] = session
110-
doctest_namespace["window"] = session.attached_window
111-
doctest_namespace["pane"] = session.attached_pane
110+
doctest_namespace["window"] = session.active_window
111+
doctest_namespace["pane"] = session.active_pane
112112
doctest_namespace["test_utils"] = test_utils
113113
doctest_namespace["tmp_path"] = tmp_path

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ tmuxp = 'tmuxp:cli.cli'
4747

4848
[tool.poetry.dependencies]
4949
python = "^3.8"
50-
libtmux = "~0.30.1"
50+
libtmux = "~0.31.0"
5151
colorama = ">=0.3.9"
5252
PyYAML = "^6.0"
5353

src/tmuxp/cli/load.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ def set_layout_hook(session: Session, hook_name: str) -> None:
7878
hook_name : str
7979
hook name to bind to, e.g. 'client-attached'
8080
"""
81-
cmd = ["set-hook", "-t", session.id, hook_name]
81+
assert session.id is not None
82+
cmd: t.List[str] = ["set-hook", "-t", str(session.id), hook_name]
8283
hook_cmd = []
83-
attached_window = session.attached_window
84+
active_window = session.active_window
8485
for window in session.windows:
8586
# unfortunately, select-layout won't work unless
8687
# we've literally selected the window at least once
@@ -92,7 +93,7 @@ def set_layout_hook(session: Session, hook_name: str) -> None:
9293

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

9798
# join the hook's commands with semicolons
9899
_hook_cmd = "{}".format("; ".join(hook_cmd))

src/tmuxp/cli/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def command_shell(
154154
155155
- session_name and window_name arguments
156156
- current shell: envvar ``TMUX_PANE`` for determining window and session
157-
- :attr:`libtmux.Server.attached_sessions`, :attr:`libtmux.Session.attached_window`,
158-
:attr:`libtmux.Window.attached_pane`
157+
- :attr:`libtmux.Server.attached_sessions`, :attr:`libtmux.Session.active_window`,
158+
:attr:`libtmux.Window.active_pane`
159159
"""
160160
# If inside a server, detect socket_path
161161
env_tmux = os.getenv("TMUX")

src/tmuxp/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def get_pane(window: "Window", current_pane: t.Optional["Pane"] = None) -> "Pane
154154
if current_pane is not None:
155155
pane = window.panes.get(pane_id=current_pane.pane_id)
156156
else:
157-
pane = window.attached_pane
157+
pane = window.active_pane
158158
except exc.TmuxpException as e:
159159
print(e)
160160

src/tmuxp/workspace/builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def iter_create_windows(
355355

356356
w1 = None
357357
if is_first_window_pass: # if first window, use window 1
358-
w1 = session.attached_window
358+
w1 = session.active_window
359359
w1.move_window("99")
360360

361361
start_directory = window_config.get("start_directory", None)
@@ -403,7 +403,7 @@ def iter_create_windows(
403403
assert isinstance(window, Window)
404404

405405
if is_first_window_pass: # if first window, use window 1
406-
session.attached_window.kill()
406+
session.active_window.kill()
407407

408408
if "options" in window_config and isinstance(
409409
window_config["options"],
@@ -452,7 +452,7 @@ def iter_create_panes(
452452
start=pane_base_index,
453453
):
454454
if pane_index == int(pane_base_index):
455-
pane = window.attached_pane
455+
pane = window.active_pane
456456
else:
457457

458458
def get_pane_start_directory(

tests/cli/test_load.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def test_load_symlinked_workspace(
174174
detached=True,
175175
)
176176
assert session is not None
177-
assert session.attached_window is not None
178-
pane = session.attached_window.attached_pane
177+
assert session.active_window is not None
178+
pane = session.active_window.active_pane
179179

180180
assert isinstance(session, Session)
181181
assert session.name == "samplesimple"

tests/cli/test_shell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ def test_shell(
123123
window = session.new_window(window_name=window_name)
124124
window.split_window()
125125

126-
assert window.attached_pane is not None
126+
assert window.active_pane is not None
127127

128128
template_ctx = {
129129
"SOCKET_NAME": server.socket_name,
130130
"SESSION_NAME": session.name,
131131
"WINDOW_NAME": window_name,
132-
"PANE_ID": window.attached_pane.id,
132+
"PANE_ID": window.active_pane.id,
133133
"SERVER_SOCKET_NAME": server.socket_name,
134134
}
135135

@@ -293,13 +293,13 @@ def test_shell_interactive(
293293
window = session.new_window(window_name=window_name)
294294
window.split_window()
295295

296-
assert window.attached_pane is not None
296+
assert window.active_pane is not None
297297

298298
template_ctx = {
299299
"SOCKET_NAME": server.socket_name,
300300
"SESSION_NAME": session.name,
301301
"WINDOW_NAME": window_name,
302-
"PANE_ID": window.attached_pane.id,
302+
"PANE_ID": window.active_pane.id,
303303
"SERVER_SOCKET_NAME": server.socket_name,
304304
}
305305

0 commit comments

Comments
 (0)