Skip to content

Commit e1b3947

Browse files
authored
Merge pull request #169 from tony/global-options
Add ability to specify session/global options
2 parents eb9c134 + bce4440 commit e1b3947

18 files changed

+199
-54
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ env:
1414
- TMUX_VERSION=2.0
1515
- TMUX_VERSION=1.8
1616
- TMUX_VERSION=1.9a
17+
matrix:
18+
allow_failures:
19+
- env: TMUX_VERSION=master
1720
before_install:
1821
- export PIP_USE_MIRRORS=true
1922
- pip install --upgrade pytest # https://github.com/travis-ci/travis-ci/issues/4873

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changelog
44

55
Here you can find the recent changes to tmuxp
66

7+
- :feature:`65` Ability to specify ``options`` and ``global_options`` via
8+
configuration. Also you can specify environment variables via that.
9+
10+
Include tests.
11+
712
- :release:`1.1.1 <2016-06-02>`
813
- :bug:`167 backported` fix attaching multiple sessions
914
- :bug:`165 backported` fix typo in error output, thanks @fpietka

doc/examples.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ Environment variable replacing
166166
------------------------------
167167

168168
tmuxp will replace environment variables wrapped in curly brackets
169-
for the following variables:
169+
for values of these settings:
170170

171171
- ``start_directory``
172172
- ``before_script``
173173
- ``session_name``
174174
- ``window_name``
175175
- ``shell_command_before``
176+
- ``global_options``
177+
- ``options`` in session scope and window scope
176178

177179
tmuxp replaces these variables before-hand with variables in the
178180
terminal ``tmuxp`` invokes in.
@@ -278,19 +280,25 @@ JSON
278280
.. literalinclude:: ../examples/window-index.json
279281
:language: json
280282

281-
Automatic Rename
283+
Set tmux options
282284
----------------
283285

286+
Works with global (server-wide) options, session options
287+
and window options.
288+
289+
Including ``automatic-rename``, ``default-shell``,
290+
``default-command``, etc.
291+
284292
YAML
285293
~~~~
286294

287-
.. literalinclude:: ../examples/automatic-rename.yaml
295+
.. literalinclude:: ../examples/options.yaml
288296
:language: yaml
289297

290298
JSON
291299
~~~~
292300

293-
.. literalinclude:: ../examples/automatic-rename.json
301+
.. literalinclude:: ../examples/options.json
294302
:language: json
295303

296304
Main pane height

examples/env-variables.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"before_script": "${MY_ENV_VAR}/test3.sh",
2+
"before_script": "${MY_ENV_VAR}/test3.sh",
33
"windows": [
44
{
55
"panes": [
@@ -8,24 +8,26 @@
88
"tail -F /var/log/syslog"
99
]
1010
}
11-
],
12-
"start_directory": "/var/log",
11+
],
12+
"start_directory": "/var/log",
1313
"window_name": "editor"
14-
},
14+
},
1515
{
1616
"panes": [
1717
{
1818
"shell_command": [
19-
"htop",
19+
"htop",
2020
"ls $PWD"
2121
]
2222
}
2323
],
24-
"window_name": "logging for {USER}",
25-
"automatic_rename": true
24+
"window_name": "logging for ${USER}",
25+
"options": {
26+
"automatic-rename": true
27+
}
2628
}
27-
],
28-
"shell_command_before": "echo ${PWD}",
29-
"start_directory": "${PWD}/test",
29+
],
30+
"shell_command_before": "echo ${PWD}",
31+
"start_directory": "${PWD}/test",
3032
"session_name": "session - ${USER} (${MY_ENV_VAR})"
31-
}
33+
}

examples/env-variables.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ windows:
99
- tail -F /var/log/syslog
1010
start_directory: /var/log
1111
- window_name: logging for ${USER}
12-
automatic_rename: true
12+
options:
13+
automatic-rename: true
1314
panes:
1415
- shell_command:
1516
- htop
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,12 @@
2626
}
2727
],
2828
"session_name": "test window options",
29-
"start_directory": "~"
29+
"start_directory": "~",
30+
"global_options": {
31+
"default-shell": "/bin/sh",
32+
"default-command": "/bin/sh"
33+
},
34+
"options": {
35+
"main-pane-height": "${MAIN_PANE_HEIGHT}"
36+
}
3037
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
session_name: test window options
22
start_directory: '~'
3+
global_options:
4+
default-shell: /bin/sh
5+
default-command: /bin/sh
6+
options:
7+
main-pane-height: ${MAIN_PANE_HEIGHT} # works with en variables
38
windows:
49
- layout: main-horizontal
510
options:

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
kaptan>=0.5.7
2-
libtmux==0.4.1
2+
libtmux==0.5
33
click==6.6
44
colorama

tests/fixtures/config/expand1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
{
3434
'start_directory': '/var/log',
35-
'options': {'automatic_rename': True, },
35+
'options': {'automatic-rename': True, },
3636
'panes': [
3737
{
3838
'shell_command': 'htop'
@@ -95,7 +95,7 @@
9595
},
9696
{
9797
'start_directory': '/var/log',
98-
'options': {'automatic_rename': True},
98+
'options': {'automatic-rename': True},
9999
'panes': [
100100
{'shell_command': ['htop']},
101101
{'shell_command': ['vim']}

tests/fixtures/config/shell_command_before.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
]
4141
},
4242
{
43-
'options': {'automatic_rename': True, },
43+
'options': {'automatic-rename': True, },
4444
'panes': [
4545
{'shell_command': ['htop']}
4646
]
@@ -92,7 +92,7 @@
9292
]
9393
},
9494
{
95-
'options': {'automatic_rename': True, },
95+
'options': {'automatic-rename': True, },
9696
'panes': [
9797
{'shell_command': ['htop']}
9898
]
@@ -155,7 +155,7 @@
155155
},
156156
{
157157
'start_directory': '/',
158-
'options': {'automatic_rename': True, },
158+
'options': {'automatic-rename': True, },
159159
'panes': [
160160
{
161161
'shell_command': ['htop']

0 commit comments

Comments
 (0)