Skip to content

Commit 9e1212f

Browse files
kstilwelltony
authored andcommitted
Fixes to address #170
- If window is specified in tmuxp configuration without panes assume that means one pane with no shell commands is intended
1 parent db7b9d4 commit 9e1212f

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

tests/test_config.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,24 @@ def test_trickle_relative_start_directory():
236236
assert test_config == fixtures.trickle.expected
237237

238238

239+
def test_trickle_window_with_no_pane_config():
240+
test_yaml = """
241+
session_name: test_session
242+
windows:
243+
- window_name: test_1
244+
panes:
245+
- shell_command:
246+
- ls -l
247+
- window_name: test_no_panes
248+
"""
249+
sconfig = load_yaml(test_yaml)
250+
config.validate_schema(sconfig)
251+
252+
assert config.expand(config.trickle(sconfig))['windows'][1]['panes'][0] == {
253+
'shell_command': []
254+
}
255+
256+
239257
def test_expands_blank_panes():
240258
"""Expand blank config into full form.
241259

tmuxp/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ def validate_schema(sconf):
4242
if 'window_name' not in window:
4343
raise exc.ConfigError('config window is missing "window_name"')
4444

45-
if 'panes' not in window:
46-
raise exc.ConfigError(
47-
'config window %s requires list of panes' % window['window_name']
48-
)
49-
5045
return True
5146

5247

@@ -370,6 +365,11 @@ def trickle(sconf):
370365
if 'suppress_history' not in windowconfig:
371366
windowconfig['suppress_history'] = suppress_history
372367

368+
# If panes were NOT specified for a window, assume that a single pane
369+
# with no shell commands is desired
370+
if 'panes' not in windowconfig:
371+
windowconfig['panes'] = [{'shell_command': []}]
372+
373373
for paneconfig in windowconfig['panes']:
374374
commands_before = []
375375

0 commit comments

Comments
 (0)