Skip to content

Commit 21413ae

Browse files
committed
Window.tmux adds tmux target
1 parent 84e601e commit 21413ae

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Here you can find the recent changes to tmuxp.
1313
:meth:`Pane.set_height`.
1414
- [tests] ``./run_tests.py --tests`` now automatically prepends
1515
``tmuxp.testsuite`` to names.
16+
- [internal] :meth:`Window.tmux` and :meth:`Pane.tmux` will automatically add
17+
their ``{window/pane}_id`` if one isn't specific.
1618

1719
2013-10-27
1820
----------

tmuxp/window.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ def by(val, *args):
7070

7171
return list(filter(by, self.server._windows))[0]
7272

73-
def tmux(self, *args, **kwargs):
74-
# if '-t' not in kwargs:
75-
# kwargs['-t'] = self.get['session_id']
76-
return self.server.tmux(*args, **kwargs)
73+
def tmux(self, cmd, *args, **kwargs):
74+
if not len([arg for arg in args if '-t' in str(arg)]):
75+
args = ('-t', self.get('window_id')) + args
76+
77+
return self.server.tmux(cmd, *args, **kwargs)
7778

7879
def select_layout(self, layout=None):
7980
'''
@@ -105,7 +106,6 @@ def select_layout(self, layout=None):
105106
'''
106107
self.tmux(
107108
'select-layout',
108-
'-t%s' % self.target, # target (name of session)
109109
layout
110110
)
111111

@@ -132,7 +132,6 @@ def set_window_option(self, option, value):
132132

133133
process = self.tmux(
134134
'set-window-option',
135-
'-t%s' % self['window_id'],
136135
option, value
137136
)
138137

@@ -216,7 +215,6 @@ def rename_window(self, new_name):
216215
try:
217216
self.tmux(
218217
'rename-window',
219-
'-t%s' % self.target,
220218
new_name
221219
)
222220
self['window_name'] = new_name

0 commit comments

Comments
 (0)