Skip to content

Commit 4283849

Browse files
committed
remove automatic_rename to reimplement
1 parent 1480138 commit 4283849

File tree

7 files changed

+19
-29
lines changed

7 files changed

+19
-29
lines changed

.tmuxp.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ windows:
44
layout: main-horizontal
55
options:
66
main-pane-height: 50
7-
start_directory: ./
87
shell_command_before:
98
- command -v virtualenv >/dev/null 2>&1 || { pip install virtualenv; }
109
- '[ -d .env -a -f .env/bin/activate ] && source .env/bin/activate || virtualenv .env'
@@ -24,8 +23,6 @@ windows:
2423
layout: main-horizontal
2524
options:
2625
main-pane-height: 50
27-
start_directory: ./
28-
automatic_rename: true
2926
shell_command_before:
3027
- command -v virtualenv >/dev/null 2>&1 || { pip install virtualenv; }
3128
- '[ -d .env -a -f .env/bin/activate ] && source .env/bin/activate || virtualenv .env'

tmuxp/session.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def __init__(self, server=None, **kwargs):
3636
if not 'session_id' in kwargs:
3737
raise ValueError('Session requires a `session_id`')
3838
self._session_id = kwargs['session_id']
39-
4039
self.server._update_windows()
4140

4241
@property
@@ -124,7 +123,6 @@ def rename_session(self, new_name):
124123

125124
def new_window(self,
126125
window_name=None,
127-
automatic_rename=False,
128126
attach=True):
129127
'''
130128
``$ tmux new-window``
@@ -142,13 +140,11 @@ def new_window(self,
142140
143141
:type window_name: string
144142
145-
:param automatic_rename: assume automatic_rename if no window_name.
146-
:type automatic_rename: bool
147-
148143
:param attach: make new window the current window after creating it,
149144
default True.
150145
:param type: bool
151146
'''
147+
152148
wformats = ['session_name', 'session_id'] + formats.WINDOW_FORMATS
153149
tmux_formats = ['#{%s}' % f for f in wformats]
154150

@@ -159,7 +155,7 @@ def new_window(self,
159155
)
160156

161157
if window_name:
162-
window_args += ('-n', window_name)
158+
window_args += ('-n%s' % window_name,)
163159

164160
if not attach:
165161
window_args += ('-d',)
@@ -177,9 +173,6 @@ def new_window(self,
177173
window = dict((k, v) for k, v in window.items() if v)
178174
window = Window(session=self, **window)
179175

180-
if automatic_rename:
181-
window.set_window_option('automatic-rename', True)
182-
183176
self.server._update_windows()
184177

185178
return window

tmuxp/testsuite/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def tearDownClass(cls):
154154
{'shell_command': ['tail -F /var/log/syslog'],
155155
'start_directory':'/var/log'}
156156
]}, {
157-
'automatic_rename': True,
157+
'options': {'automatic_rename': True, },
158158
'panes': [
159159
{'shell_command': ['htop']}
160160
]

tmuxp/testsuite/test_config.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
{'shell_command': ['tail -F /var/log/syslog'],
3232
'start_directory':'/var/log'}
3333
]}, {
34-
'automatic_rename': True,
34+
'options': {
35+
'automatic_rename': True,
36+
},
3537
'panes': [
3638
{'shell_command': ['htop']}
3739
]
@@ -147,7 +149,7 @@ class ExpandTest(unittest.TestCase):
147149
]
148150
},
149151
{
150-
'automatic_rename': True,
152+
'options': { 'automatic_rename': True, },
151153
'panes': [
152154
{'shell_command': 'htop'},
153155
'vim',
@@ -177,7 +179,7 @@ class ExpandTest(unittest.TestCase):
177179
]
178180
},
179181
{
180-
'automatic_rename': True,
182+
'options': { 'automatic_rename': True },
181183
'panes': [
182184
{'shell_command': ['htop']},
183185
{'shell_command': ['vim']}
@@ -220,7 +222,7 @@ class InlineTest(unittest.TestCase):
220222
]
221223
},
222224
{
223-
'automatic_rename': True,
225+
'options': { 'automatic_rename': True, },
224226
'panes': [
225227
{'shell_command': ['htop']}
226228
]
@@ -249,7 +251,7 @@ class InlineTest(unittest.TestCase):
249251
]
250252
},
251253
{
252-
'automatic_rename': True,
254+
'options': { 'automatic_rename': True, },
253255
'panes': [
254256
{'shell_command': 'htop'}
255257
]
@@ -301,7 +303,7 @@ class InheritanceTest(unittest.TestCase):
301303
]
302304
},
303305
{
304-
'automatic_rename': True,
306+
'options': { 'automatic_rename': True, },
305307
'panes': [
306308
{'shell_command': ['htop']}
307309
]
@@ -336,7 +338,7 @@ class InheritanceTest(unittest.TestCase):
336338
]
337339
},
338340
{
339-
'automatic_rename': True,
341+
'options': { 'automatic_rename': True, },
340342
'panes': [
341343
{'shell_command': ['htop'], 'start_directory':'/'}
342344
]
@@ -412,7 +414,7 @@ class ShellCommandBeforeTest(unittest.TestCase):
412414
]
413415
},
414416
{
415-
'automatic_rename': True,
417+
'options': { 'automatic_rename': True, },
416418
'panes': [
417419
{'shell_command': ['htop']}
418420
]
@@ -453,7 +455,7 @@ class ShellCommandBeforeTest(unittest.TestCase):
453455
]
454456
},
455457
{
456-
'automatic_rename': True,
458+
'options': { 'automatic_rename': True, },
457459
'panes': [
458460
{'shell_command': ['htop']}
459461
]
@@ -494,7 +496,7 @@ class ShellCommandBeforeTest(unittest.TestCase):
494496
]
495497
},
496498
{
497-
'automatic_rename': True,
499+
'options': {'automatic_rename': True, },
498500
'panes': [
499501
{'shell_command': ['htop']}
500502
]

tmuxp/testsuite/test_workspacebuilder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class TwoPaneTest(TmuxTestCase):
3232
start_directory: /var/log
3333
window_name: logging
3434
- window_name: test
35-
automatic_rename: true
3635
panes:
3736
- shell_command:
3837
- htop

tmuxp/window.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ def set_window_option(self, option, value):
121121
122122
$ tmux set-window-option <option> <value>
123123
124-
:param option: the window option. such as 'automatic_rename'.
125-
:type option: string
126124
:param value: window value. True/False will turn in 'on' and 'off'.
127125
:type value: string or bool
128126
'''

tmuxp/workspacebuilder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def build(self, session=None):
123123
assert(self.sconf['session_name'] == session.get('session_name'))
124124

125125
assert(isinstance(session, Session))
126+
if 'options' in self.sconf and isinstance(self.sconf['options'], dict):
127+
for key, val in self.sconf['options'].items():
128+
s.set_option(key, val)
129+
126130

127131
for w, wconf in self.iter_create_windows(session):
128132
assert(isinstance(w, Window))
@@ -145,10 +149,8 @@ def iter_create_windows(self, s):
145149
:rtype: :class:`Window`
146150
'''
147151
for i, wconf in enumerate(self.sconf['windows'], start=1):
148-
automatic_rename = False
149152
if 'window_name' not in wconf:
150153
window_name = None
151-
automatic_rename = True
152154
else:
153155
window_name = wconf['window_name']
154156

@@ -159,7 +161,6 @@ def iter_create_windows(self, s):
159161
else:
160162
w = s.new_window(
161163
window_name=window_name,
162-
automatic_rename=automatic_rename,
163164
attach=False # do not move to the new window
164165
)
165166

0 commit comments

Comments
 (0)