@@ -125,7 +125,6 @@ def panes(self) -> QueryList["Pane"]: # type: ignore
125
125
return QueryList (panes )
126
126
127
127
#
128
- # Command (pane-scoped)
129
128
#
130
129
def cmd (self , cmd : str , * args : t .Any , ** kwargs : t .Any ) -> tmux_cmd :
131
130
"""Return :meth:`Server.cmd` defaulting to ``target_window`` as target.
@@ -136,12 +135,11 @@ def cmd(self, cmd: str, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
136
135
``args`` will override using the object's ``window_id`` as target.
137
136
"""
138
137
if not any (arg .startswith ("-t" ) for arg in args ):
139
- args = ("-t" , self .window_id ) + args
138
+ args = ("-t" , self .window_id , * args )
140
139
141
140
return self .server .cmd (cmd , * args , ** kwargs )
142
141
143
142
#
144
- # Commands (tmux-like)
145
143
#
146
144
def select_pane (self , target_pane : t .Union [str , int ]) -> t .Optional ["Pane" ]:
147
145
"""
@@ -219,21 +217,18 @@ def split_window(
219
217
"""
220
218
tmux_formats = ["#{pane_id}" + FORMAT_SEPARATOR ]
221
219
222
- # '-t%s' % self.attached_pane.get('pane_id'),
223
220
# 2013-10-18 LOOK AT THIS, rm'd it..
224
- tmux_args : t .Tuple [str , ...] = tuple ()
221
+ tmux_args : t .Tuple [str , ...] = ()
225
222
226
223
if target is not None :
227
224
tmux_args += ("-t%s" % target ,)
228
225
else :
229
226
if len (self .panes ):
230
227
tmux_args += (
231
- "-t%s:%s.%s"
232
- % (self .session_id , self .window_id , self .panes [0 ].pane_index ),
228
+ f"-t{ self .session_id } :{ self .window_id } .{ self .panes [0 ].pane_index } " ,
233
229
)
234
230
else :
235
- tmux_args += ("-t%s:%s" % (self .session_id , self .window_id ),)
236
- # tmux_args += ("-t%s" % self.panes[0].pane_id,)
231
+ tmux_args += (f"-t{ self .session_id } :{ self .window_id } " ,)
237
232
238
233
if vertical :
239
234
tmux_args += ("-v" ,)
@@ -313,7 +308,7 @@ def select_layout(self, layout: t.Optional[str] = None) -> "Window":
313
308
'custom'
314
309
custom dimensions (see :term:`tmux(1)` manpages).
315
310
"""
316
- cmd = ["select-layout" , "-t{}:{}" . format ( self .session_id , self . window_index ) ]
311
+ cmd = ["select-layout" , f "-t{ self . session_id } :{ self .window_index } " ]
317
312
318
313
if layout : # tmux allows select-layout without args
319
314
cmd .append (layout )
@@ -349,7 +344,7 @@ def set_window_option(self, option: str, value: t.Union[int, str]) -> "Window":
349
344
350
345
cmd = self .cmd (
351
346
"set-window-option" ,
352
- "-t{}:{}" . format ( self .session_id , self . window_index ) ,
347
+ f "-t{ self . session_id } :{ self .window_index } " ,
353
348
option ,
354
349
value ,
355
350
)
@@ -375,7 +370,7 @@ def show_window_options(self, g: t.Optional[bool] = False) -> "WindowOptionDict"
375
370
g : str, optional
376
371
Pass ``-g`` flag for global variable, default False.
377
372
"""
378
- tmux_args : t .Tuple [str , ...] = tuple ()
373
+ tmux_args : t .Tuple [str , ...] = ()
379
374
380
375
if g :
381
376
tmux_args += ("-g" ,)
@@ -419,7 +414,7 @@ def show_window_option(
419
414
:exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
420
415
:exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
421
416
"""
422
- tmux_args : t .Tuple [t .Union [str , int ], ...] = tuple ()
417
+ tmux_args : t .Tuple [t .Union [str , int ], ...] = ()
423
418
424
419
if g :
425
420
tmux_args += ("-g" ,)
@@ -486,7 +481,7 @@ def kill_window(self) -> None:
486
481
487
482
proc = self .cmd (
488
483
"kill-window" ,
489
- "-t{}:{}" . format ( self .session_id , self . window_index ) ,
484
+ f "-t{ self . session_id } :{ self .window_index } " ,
490
485
)
491
486
492
487
if proc .stderr :
@@ -510,7 +505,7 @@ def move_window(
510
505
session = session or self .session_id
511
506
proc = self .cmd (
512
507
"move-window" ,
513
- "-s{}:{}" . format ( self .session_id , self . window_index ) ,
508
+ f "-s{ self . session_id } :{ self .window_index } " ,
514
509
f"-t{ session } :{ destination } " ,
515
510
)
516
511
0 commit comments