@@ -327,7 +327,15 @@ def select_layout(self, layout: t.Optional[str] = None) -> "Window":
327
327
328
328
return self
329
329
330
- def set_window_option (self , option : str , value : t .Union [int , str ]) -> "Window" :
330
+ def set_window_option (
331
+ self ,
332
+ option : str ,
333
+ value : t .Union [int , str ],
334
+ format : t .Optional [bool ] = None ,
335
+ unset : t .Optional [bool ] = None ,
336
+ unset_panes : t .Optional [bool ] = None ,
337
+ prevent_overwrite : t .Optional [bool ] = None ,
338
+ ) -> "Window" :
331
339
"""Set option for tmux window.
332
340
333
341
Wraps ``$ tmux set-window-option <option> <value>``.
@@ -345,16 +353,34 @@ def set_window_option(self, option: str, value: t.Union[int, str]) -> "Window":
345
353
:exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
346
354
:exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
347
355
"""
356
+ flags : list [str ] = []
348
357
if isinstance (value , bool ) and value :
349
358
value = "on"
350
359
elif isinstance (value , bool ) and not value :
351
360
value = "off"
352
361
362
+ if unset is not None and unset :
363
+ assert isinstance (unset , bool )
364
+ flags .append ("-u" )
365
+
366
+ if unset_panes is not None and unset_panes :
367
+ assert isinstance (unset_panes , bool )
368
+ flags .append ("-U" )
369
+
370
+ if format is not None and format :
371
+ assert isinstance (format , bool )
372
+ flags .append ("-F" )
373
+
374
+ if prevent_overwrite is not None and prevent_overwrite :
375
+ assert isinstance (prevent_overwrite , bool )
376
+ flags .append ("-o" )
377
+
353
378
cmd = self .cmd (
354
379
"set-window-option" ,
355
380
f"-t{ self .session_id } :{ self .window_index } " ,
356
381
option ,
357
382
value ,
383
+ * flags ,
358
384
)
359
385
360
386
if isinstance (cmd .stderr , list ) and len (cmd .stderr ):
0 commit comments