Skip to content

Commit cec24e5

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 d20e653 commit cec24e5

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
@@ -265,6 +265,13 @@ def iter_create_windows(self, session, append=False):
265265
else:
266266
ws = None
267267

268+
# If the first pane specifies a shell, use that instead.
269+
try:
270+
if wconf['panes'][0]['shell'] != '':
271+
ws = wconf['panes'][0]['shell']
272+
except (KeyError, IndexError):
273+
pass
274+
268275
w = session.new_window(
269276
window_name=window_name,
270277
start_directory=sd,
@@ -328,8 +335,20 @@ def get_pane_start_directory():
328335
else:
329336
return None
330337

338+
def get_pane_shell():
339+
340+
if 'shell' in pconf:
341+
return pconf['shell']
342+
elif 'window_shell' in wconf:
343+
return wconf['window_shell']
344+
else:
345+
return None
346+
331347
p = w.split_window(
332-
attach=True, start_directory=get_pane_start_directory(), target=p.id
348+
attach=True,
349+
start_directory=get_pane_start_directory(),
350+
shell=get_pane_shell(),
351+
target=p.id
333352
)
334353

335354
assert isinstance(p, Pane)

0 commit comments

Comments
 (0)