Skip to content

Commit 597e537

Browse files
committed
refactor: window_config -> window_dict
1 parent 8d8dba6 commit 597e537

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/tmuxp/config.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -362,42 +362,42 @@ def trickle(workspace_dict):
362362
else:
363363
suppress_history = None
364364

365-
for window_config in workspace_dict["windows"]:
365+
for window_dict in workspace_dict["windows"]:
366366

367367
# Prepend start_directory to relative window commands
368368
if session_start_directory:
369-
if "start_directory" not in window_config:
370-
window_config["start_directory"] = session_start_directory
369+
if "start_directory" not in window_dict:
370+
window_dict["start_directory"] = session_start_directory
371371
else:
372372
if not any(
373-
window_config["start_directory"].startswith(a) for a in ["~", "/"]
373+
window_dict["start_directory"].startswith(a) for a in ["~", "/"]
374374
):
375375
window_start_path = os.path.join(
376-
session_start_directory, window_config["start_directory"]
376+
session_start_directory, window_dict["start_directory"]
377377
)
378-
window_config["start_directory"] = window_start_path
378+
window_dict["start_directory"] = window_start_path
379379

380380
# We only need to trickle to the window, workspace builder checks wconf
381381
if suppress_history is not None:
382-
if "suppress_history" not in window_config:
383-
window_config["suppress_history"] = suppress_history
382+
if "suppress_history" not in window_dict:
383+
window_dict["suppress_history"] = suppress_history
384384

385385
# If panes were NOT specified for a window, assume that a single pane
386386
# with no shell commands is desired
387-
if "panes" not in window_config:
388-
window_config["panes"] = [{"shell_command": []}]
387+
if "panes" not in window_dict:
388+
window_dict["panes"] = [{"shell_command": []}]
389389

390-
for pane_idx, pane_config in enumerate(window_config["panes"]):
390+
for pane_idx, pane_config in enumerate(window_dict["panes"]):
391391
commands_before = []
392392

393393
# Prepend shell_command_before to commands
394394
if "shell_command_before" in workspace_dict:
395395
commands_before.extend(
396396
workspace_dict["shell_command_before"]["shell_command"]
397397
)
398-
if "shell_command_before" in window_config:
398+
if "shell_command_before" in window_dict:
399399
commands_before.extend(
400-
window_config["shell_command_before"]["shell_command"]
400+
window_dict["shell_command_before"]["shell_command"]
401401
)
402402
if "shell_command_before" in pane_config:
403403
commands_before.extend(
@@ -407,7 +407,7 @@ def trickle(workspace_dict):
407407
if "shell_command" in pane_config:
408408
commands_before.extend(pane_config["shell_command"])
409409

410-
window_config["panes"][pane_idx]["shell_command"] = commands_before
410+
window_dict["panes"][pane_idx]["shell_command"] = commands_before
411411
# pane_config['shell_command'] = commands_before
412412

413413
return workspace_dict
@@ -481,29 +481,29 @@ def import_tmuxinator(workspace_dict):
481481
"rbenv shell %s" % workspace_dict["rbenv"]
482482
)
483483

484-
for window_config in workspace_dict["windows"]:
485-
for k, v in window_config.items():
486-
window_config = {"window_name": k}
484+
for window_dict in workspace_dict["windows"]:
485+
for k, v in window_dict.items():
486+
window_dict = {"window_name": k}
487487

488488
if isinstance(v, str) or v is None:
489-
window_config["panes"] = [v]
490-
tmuxp_config["windows"].append(window_config)
489+
window_dict["panes"] = [v]
490+
tmuxp_config["windows"].append(window_dict)
491491
continue
492492
elif isinstance(v, list):
493-
window_config["panes"] = v
494-
tmuxp_config["windows"].append(window_config)
493+
window_dict["panes"] = v
494+
tmuxp_config["windows"].append(window_dict)
495495
continue
496496

497497
if "pre" in v:
498-
window_config["shell_command_before"] = v["pre"]
498+
window_dict["shell_command_before"] = v["pre"]
499499
if "panes" in v:
500-
window_config["panes"] = v["panes"]
500+
window_dict["panes"] = v["panes"]
501501
if "root" in v:
502-
window_config["start_directory"] = v["root"]
502+
window_dict["start_directory"] = v["root"]
503503

504504
if "layout" in v:
505-
window_config["layout"] = v["layout"]
506-
tmuxp_config["windows"].append(window_config)
505+
window_dict["layout"] = v["layout"]
506+
tmuxp_config["windows"].append(window_dict)
507507
return tmuxp_config
508508

509509

0 commit comments

Comments
 (0)