Skip to content

Commit 9bf267a

Browse files
nvasilastony
authored andcommitted
Fix window focus
Save attached window before set_layout_hook actually execute the hooks and select the saved after the hooks.
1 parent 345a23c commit 9bf267a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tmuxp/cli.py

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def set_layout_hook(session, hook_name):
162162
"""
163163
cmd = ['set-hook', '-t', session.id, hook_name]
164164
hook_cmd = []
165+
attached_window = session.attached_window
165166
for window in session.windows:
166167
# unfortunately, select-layout won't work unless
167168
# we've literally selected the window at least once
@@ -177,6 +178,7 @@ def set_layout_hook(session, hook_name):
177178
target_session=session.id, hook_name=hook_name
178179
)
179180
)
181+
hook_cmd.append('selectw -t {}'.format(attached_window.id))
180182

181183
# join the hook's commands with semicolons
182184
hook_cmd = '{}'.format('; '.join(hook_cmd))

0 commit comments

Comments
 (0)