Skip to content
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

Add a colon to the end of the target session when creating windows #38

Merged
merged 2 commits into from
Jan 29, 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
2 changes: 1 addition & 1 deletion catmux/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def create(self, first=False):
tmux_wrapper = tmux.TmuxWrapper(server_name=self.server_name)
target_window = ":".join([self.session_name, getattr(self, "name")])
if not first:
tmux_wrapper.tmux_call(["new-window", "-t", self.session_name])
tmux_wrapper.tmux_call(["new-window", "-t", self.session_name + ":"])
tmux_wrapper.tmux_call(
["rename-window", "-t", f"{self.session_name}:$", getattr(self, "name")]
)
Expand Down
28 changes: 14 additions & 14 deletions test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def test_full_circle(mock_popen):
show_layouts: true

windows:
- name: foo
- name: foobar
if: show_layouts
commands:
- echo "${replacement_param}"
- name: bar
- name: hello
layout: tiled
delay: 1
splits:
Expand All @@ -71,23 +71,23 @@ def test_full_circle(mock_popen):
- echo "second_split"
"""
server_name = "my_server"
session_name = "my_session"
session_name = "foo"
session = Session(server_name=server_name, session_name=session_name)
session.init_from_yaml(yaml.safe_load(CONFIG))

session.run(debug=True)
calls = [
["rename-window", "-t", "my_session:$", "foo"],
["send-keys", "-t", "my_session:foo", 'echo "hello"', "C-m"],
["send-keys", "-t", "my_session:foo", 'echo "world"', "C-m"],
["send-keys", "-t", "my_session:foo", 'echo "schubidoo"', "C-m"],
["select-window", "-t", "my_session:foobar"],
["new-window", "-t", "my_session"],
["rename-window", "-t", "my_session:$", "bar"],
["send-keys", "-t", "my_session:bar", 'echo "first_split"', "C-m"],
["split-window", "-t", "my_session:bar"],
["send-keys", "-t", "my_session:bar", 'echo "second_split"', "C-m"],
["select-layout", "-t", "my_session:bar", "tiled"],
["rename-window", "-t", "foo:$", "foobar"],
["send-keys", "-t", "foo:foobar", 'echo "hello"', "C-m"],
["send-keys", "-t", "foo:foobar", 'echo "world"', "C-m"],
["send-keys", "-t", "foo:foobar", 'echo "schubidoo"', "C-m"],
["select-window", "-t", "foo:foobar"],
["new-window", "-t", "foo:"],
["rename-window", "-t", "foo:$", "hello"],
["send-keys", "-t", "foo:hello", 'echo "first_split"', "C-m"],
["split-window", "-t", "foo:hello"],
["send-keys", "-t", "foo:hello", 'echo "second_split"', "C-m"],
["select-layout", "-t", "foo:hello", "tiled"],
]
for call in calls:
mock_popen.assert_any_call(["tmux", "-L", server_name] + call)
Loading