@@ -351,6 +351,8 @@ def new_session(
351
351
start_directory : t .Optional [str ] = None ,
352
352
window_name : t .Optional [str ] = None ,
353
353
window_command : t .Optional [str ] = None ,
354
+ window_width : t .Optional [int ] = None ,
355
+ window_height : t .Optional [int ] = None ,
354
356
* args : t .Any ,
355
357
** kwargs : t .Any ,
356
358
) -> Session :
@@ -388,11 +390,17 @@ def new_session(
388
390
::
389
391
390
392
$ tmux new-session -n <window_name>
391
- window_command : str
393
+ window_command : str, optional
392
394
execute a command on starting the session. The window will close
393
395
when the command exits. NOTE: When this command exits the window
394
396
will close. This feature is useful for long-running processes
395
397
where the closing of the window upon completion is desired.
398
+ window_width : int, optional
399
+ Force the specified width instead of the tmux default for a
400
+ dettached session
401
+ window_height : int, optional
402
+ Force the specified height instead of the tmux default for a
403
+ dettached session
396
404
397
405
Returns
398
406
-------
@@ -455,10 +463,11 @@ def new_session(
455
463
if window_name :
456
464
tmux_args += ("-n" , window_name )
457
465
458
- # tmux 2.6 gives unattached sessions a tiny default area
459
- # no need send in -x/-y if they're in a client already, though
460
- if has_gte_version ("2.6" ) and "TMUX" not in os .environ :
461
- tmux_args += ("-x" , 800 , "-y" , 600 )
466
+ if window_width is not None :
467
+ tmux_args += ("-x" , window_width )
468
+
469
+ if window_height is not None :
470
+ tmux_args += ("-y" , window_height )
462
471
463
472
if window_command :
464
473
tmux_args += (window_command ,)
0 commit comments