@@ -351,6 +351,8 @@ def new_session(
351351 start_directory : t .Optional [str ] = None ,
352352 window_name : t .Optional [str ] = None ,
353353 window_command : t .Optional [str ] = None ,
354+ window_width : t .Optional [int ] = None ,
355+ window_height : t .Optional [int ] = None ,
354356 * args : t .Any ,
355357 ** kwargs : t .Any ,
356358 ) -> Session :
@@ -388,11 +390,17 @@ def new_session(
388390 ::
389391
390392 $ tmux new-session -n <window_name>
391- window_command : str
393+ window_command : str, optional
392394 execute a command on starting the session. The window will close
393395 when the command exits. NOTE: When this command exits the window
394396 will close. This feature is useful for long-running processes
395397 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
396404
397405 Returns
398406 -------
@@ -455,10 +463,11 @@ def new_session(
455463 if window_name :
456464 tmux_args += ("-n" , window_name )
457465
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 )
462471
463472 if window_command :
464473 tmux_args += (window_command ,)
0 commit comments