@@ -157,7 +157,9 @@ use zellij_utils::cli::CliArgs;
157157use zellij_utils:: {
158158 channels:: { self , ChannelWithContext , SenderWithContext } ,
159159 consts:: { set_permissions, ZELLIJ_SOCK_DIR } ,
160- data:: { ClientId , ConnectToSession , KeyWithModifier , LayoutInfo , LayoutMetadata } ,
160+ data:: {
161+ ClientId , CommandOrPlugin , ConnectToSession , KeyWithModifier , LayoutInfo , LayoutMetadata ,
162+ } ,
161163 envs,
162164 errors:: { ClientContext , ContextType , ErrorInstruction } ,
163165 input:: {
@@ -503,7 +505,12 @@ pub fn spawn_server(socket_path: &Path, debug: bool) -> io::Result<()> {
503505#[ derive( Debug , Clone ) ]
504506pub enum ClientInfo {
505507 Attach ( String , Options ) ,
506- New ( String , Option < LayoutInfo > , Option < PathBuf > ) , // PathBuf -> explicit cwd
508+ New (
509+ String ,
510+ Option < LayoutInfo > ,
511+ Option < PathBuf > ,
512+ Option < Vec < CommandOrPlugin > > ,
513+ ) , // PathBuf -> explicit cwd
507514 Resurrect ( String , PathBuf , bool , Option < PathBuf > ) , // (name, path_to_layout, force_run_commands, cwd)
508515 Watch ( String , Options ) , // Watch mode (read-only)
509516}
@@ -512,24 +519,30 @@ impl ClientInfo {
512519 pub fn get_session_name ( & self ) -> & str {
513520 match self {
514521 Self :: Attach ( ref name, _) => name,
515- Self :: New ( ref name, _layout_info, _layout_cwd) => name,
522+ Self :: New ( ref name, _layout_info, _layout_cwd, _initial_panes ) => name,
516523 Self :: Resurrect ( ref name, _, _, _) => name,
517524 Self :: Watch ( ref name, _) => name,
518525 }
519526 }
520527 pub fn set_layout_info ( & mut self , new_layout_info : LayoutInfo ) {
521528 match self {
522- ClientInfo :: New ( _, layout_info, _) => * layout_info = Some ( new_layout_info) ,
529+ ClientInfo :: New ( _, layout_info, _, _ ) => * layout_info = Some ( new_layout_info) ,
523530 _ => { } ,
524531 }
525532 }
526533 pub fn set_cwd ( & mut self , new_cwd : PathBuf ) {
527534 match self {
528- ClientInfo :: New ( _, _, cwd) => * cwd = Some ( new_cwd) ,
535+ ClientInfo :: New ( _, _, cwd, _ ) => * cwd = Some ( new_cwd) ,
529536 ClientInfo :: Resurrect ( _, _, _, cwd) => * cwd = Some ( new_cwd) ,
530537 _ => { } ,
531538 }
532539 }
540+ pub fn set_initial_panes ( & mut self , new_initial_panes : Vec < CommandOrPlugin > ) {
541+ match self {
542+ ClientInfo :: New ( _, _, _, initial_panes) => * initial_panes = Some ( new_initial_panes) ,
543+ _ => { } ,
544+ }
545+ }
533546}
534547
535548#[ derive( Debug , Clone ) ]
@@ -1031,6 +1044,7 @@ pub fn start_client(
10311044 force_run_layout_commands : false ,
10321045 cwd : None ,
10331046 host_terminal_env : host_terminal_env ( ) ,
1047+ initial_panes : None ,
10341048 } ;
10351049 (
10361050 ClientToServerMsg :: AttachClient {
@@ -1077,6 +1091,7 @@ pub fn start_client(
10771091 force_run_layout_commands : force_run_commands,
10781092 cwd,
10791093 host_terminal_env : host_terminal_env ( ) ,
1094+ initial_panes : None ,
10801095 } ;
10811096
10821097 os_input. update_session_name ( name) ;
@@ -1101,7 +1116,7 @@ pub fn start_client(
11011116 ipc_pipe,
11021117 )
11031118 } ,
1104- ClientInfo :: New ( name, layout_info, layout_cwd) => {
1119+ ClientInfo :: New ( name, layout_info, layout_cwd, initial_panes ) => {
11051120 envs:: set_session_name ( name. clone ( ) ) ;
11061121
11071122 let cli_assets = CliAssets {
@@ -1134,6 +1149,7 @@ pub fn start_client(
11341149 force_run_layout_commands : false ,
11351150 cwd : layout_cwd,
11361151 host_terminal_env : host_terminal_env ( ) ,
1152+ initial_panes,
11371153 } ;
11381154
11391155 os_input. update_session_name ( name) ;
@@ -1652,6 +1668,7 @@ pub fn start_server_detached(
16521668 force_run_layout_commands : force_run_commands,
16531669 cwd,
16541670 host_terminal_env : host_terminal_env ( ) ,
1671+ initial_panes : None ,
16551672 } ;
16561673
16571674 os_input. update_session_name ( name) ;
@@ -1676,7 +1693,7 @@ pub fn start_server_detached(
16761693 ipc_pipe,
16771694 )
16781695 } ,
1679- ClientInfo :: New ( name, layout_info, layout_cwd) => {
1696+ ClientInfo :: New ( name, layout_info, layout_cwd, initial_panes ) => {
16801697 envs:: set_session_name ( name. clone ( ) ) ;
16811698
16821699 let cli_assets = CliAssets {
@@ -1710,6 +1727,7 @@ pub fn start_server_detached(
17101727 force_run_layout_commands : false ,
17111728 cwd : layout_cwd,
17121729 host_terminal_env : host_terminal_env ( ) ,
1730+ initial_panes,
17131731 } ;
17141732
17151733 os_input. update_session_name ( name) ;
0 commit comments