Skip to content

Commit 4ab618e

Browse files
committed
Added the ability to specify shell per pane.
Had to implement the special case for the first pane. In that case the shell for the window that is created has to be overridden. This also fixed a bug (in my opinion) that `window_shell` only affected the first pane, and none of the other panes in a window. The system unfortunatelly still bailes out, when the specified shell is not executable (e.g. doesn't even exist). The problem is an unhandeled exception when the information for the pane can't be extracted (as it never really started). Not sure how to catch that and provide a sensible message to the user.
1 parent 890e038 commit 4ab618e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tmuxp/workspacebuilder.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ def iter_create_windows(self, session, append=False):
269269
else:
270270
ws = None
271271

272+
# If the first pane specifies a shell, use that instead.
273+
try:
274+
if wconf['panes'][0]['shell'] != '':
275+
ws = wconf['panes'][0]['shell']
276+
except (KeyError, IndexError):
277+
pass
278+
272279
w = session.new_window(
273280
window_name=window_name,
274281
start_directory=sd,
@@ -332,8 +339,20 @@ def get_pane_start_directory():
332339
else:
333340
return None
334341

342+
def get_pane_shell():
343+
344+
if 'shell' in pconf:
345+
return pconf['shell']
346+
elif 'window_shell' in wconf:
347+
return wconf['window_shell']
348+
else:
349+
return None
350+
335351
p = w.split_window(
336-
attach=True, start_directory=get_pane_start_directory(), target=p.id
352+
attach=True,
353+
start_directory=get_pane_start_directory(),
354+
shell=get_pane_shell(),
355+
target=p.id
337356
)
338357

339358
assert isinstance(p, Pane)

0 commit comments

Comments
 (0)