Open
Description
Step 1: Provide a summary of your problem
tmuxp load -a workspace
duplicates existing windows in a session, when called a second time inside tmux
Step 2: Provide tmuxp details
tmux version: 3.3
libtmux version: 0.21.0
tmuxp version: 1.27.0
Step 3: Describe the problem:
Running tmuxp load -a workspace
inside tmux duplicates existing windows in a session - it would be nice if existing named windows are not recreated.
So - closing a tmux window, updating the tmuxp workspace config file and rerunning tmuxp load -a workspace
should recreate the closed window only (if all windows are named)
Steps to reproduce:
Run tmuxp load -a workspace
inside tmux a second time - windows are duplicated
Relevant Code:
The following patch to tmuxp/workspace/builder.py
skips existing named windows - but I'm new to tmuxp - a option for enabling this behavior would be necessary - and I don't know, if this is even the correct place for this patch.
--- builder.py.orig 2023-03-16 12:59:43.399597590 +0100
+++ builder.py 2023-03-21 20:46:05.998656705 +0100
@@ -346,6 +346,8 @@ class WorkspaceBuilder:
Newly created window, and the section from the tmuxp configuration
that was used to create the window.
"""
+ session_window_names = set([w.window_name for w in session.windows if w.window_name])
+
for window_iterator, window_config in enumerate(
self.session_config["windows"], start=1
):
@@ -353,6 +355,9 @@ class WorkspaceBuilder:
window_name = None
else:
window_name = window_config["window_name"]
+ if window_name in session_window_names:
+ # skip existing window
+ continue
is_first_window_pass = self.first_window_pass(
window_iterator, session, append
Thanks,
Gerald
Metadata
Metadata
Assignees
Labels
No labels