Skip to content

Commit 7a479cb

Browse files
committed
start_directory example for docs. adjust target on Window.kill_window() to session_id:window_index for compatibility
1 parent a664665 commit 7a479cb

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Here you can find the recent changes to tmuxp.
99
- [internal] :meth:`util.is_version()`
1010
- [config] [tests]: correctly :meth:`config.trickle()` the ``start_directory``.
1111
- [config] [tests]: get ``start_directory`` working for configs
12+
- [internal]: fix :meth:``Window.kill_window()`` target to
13+
``session_id:window_index`` for compatibility and pass tests.
14+
- [docs] [examples]: Example for ``start_directory``.
1215

1316
2013-10-30
1417
----------

doc/examples.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,25 @@ JSON
165165
.. literalinclude:: ../examples/main-pane-height.json
166166
:language: json
167167

168+
Start Directory
169+
---------------
170+
171+
Equivalent to ``tmux new-window -c <start-directory>``.
172+
173+
.. sidebar:: short hand
174+
175+
YAML
176+
""""
177+
178+
.. literalinclude:: ../examples/start_directory.yaml
179+
:language: yaml
180+
181+
JSON
182+
""""
183+
184+
.. literalinclude:: ../examples/start_directory.json
185+
:language: json
186+
168187
Super-advanced dev environment
169188
------------------------------
170189

examples/start_directory.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"windows": [
3+
{
4+
"panes": [
5+
"pwd",
6+
"echo 'it trickles down from session-level'"
7+
],
8+
"window_name": "should be /var/log"
9+
},
10+
{
11+
"panes": [
12+
"pwd",
13+
"echo 'has precedence'"
14+
],
15+
"start_directory": "$HOME",
16+
"window_name": "should be $HOME"
17+
}
18+
],
19+
"session_name": "start directory",
20+
"start_directory": "/var/log"
21+
}

examples/start_directory.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
session_name: start directory
2+
start_directory: /var/log
3+
windows:
4+
- window_name: should be /var/log
5+
panes:
6+
- pwd
7+
- echo 'it trickles down from session-level'
8+
- window_name: should be $HOME
9+
start_directory: $HOME
10+
panes:
11+
- pwd
12+
- echo 'has precedence'

tmuxp/window.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ def kill_window(self):
255255
:type target_window: string
256256
'''
257257

258-
proc = self.tmux('kill-window', '-t%s' % self.get('window_id'))
258+
proc = self.tmux(
259+
'kill-window',
260+
#'-t:%s' % self.get('window_id')
261+
'-t%s:%s' % (self.get('session_id'), self.get('window_index')),
262+
)
259263

260264
if proc.stderr:
261265
raise Exception(proc.stderr)

0 commit comments

Comments
 (0)