Skip to content

Commit f4aef07

Browse files
committed
Add new-window command functionality
1 parent f0e5600 commit f4aef07

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tmuxp/session.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def new_window(self,
124124
window_name=None,
125125
start_directory=None,
126126
attach=True,
127-
window_index=''):
127+
window_index='',
128+
window_command=None):
128129
"""Return :class:`Window` from ``$ tmux new-window``.
129130
130131
.. note::
@@ -177,6 +178,9 @@ def new_window(self,
177178
'-t%s:%s' % (self.get('session_id'), window_index),
178179
)
179180

181+
if window_command:
182+
window_args += (window_command,)
183+
180184
proc = self.cmd('new-window', *window_args)
181185

182186
if proc.stderr:

tmuxp/workspacebuilder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,17 @@ def iter_create_windows(self, s):
199199
else:
200200
sd = None
201201

202+
if 'window_command' in wconf:
203+
wc = wconf['window_command']
204+
else:
205+
wc = None
206+
202207
w = s.new_window(
203208
window_name=window_name,
204209
start_directory=sd,
205210
attach=False, # do not move to the new window
206211
window_index=wconf.get('window_index', ''),
212+
window_command=wc,
207213
)
208214

209215
if i == int(1) and w1: # if first window, use window 1

0 commit comments

Comments
 (0)