aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-07-09 16:52:50 +0200
committerGitHub <noreply@github.com>2026-07-09 16:52:50 +0200
commit4bfda976b110b5d3182fca004ee7031f6322253e (patch)
treeff16cdbec15673861ee0907181a25f709565b4fd /zellij-utils/src
parentfix: focus last pane correctness issues (#5344) (diff)
downloadsl0ppij-4bfda976b110b5d3182fca004ee7031f6322253e.tar.gz
sl0ppij-4bfda976b110b5d3182fca004ee7031f6322253e.tar.xz
sl0ppij-4bfda976b110b5d3182fca004ee7031f6322253e.zip
Allow creating panes/tabs from the CLI without changing focus to them (#5346)
* feat: allow opening panes and tabs from the cli without focusing them * rustfmt * fix flake * rustfmt * add pr
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/cli.rs36
-rw-r--r--zellij-utils/src/client_server_contract/common_types.proto11
-rw-r--r--zellij-utils/src/input/actions.rs56
-rw-r--r--zellij-utils/src/ipc/protobuf_conversion.rs33
-rw-r--r--zellij-utils/src/ipc/tests/roundtrip_tests.rs34
-rw-r--r--zellij-utils/src/kdl/mod.rs6
-rw-r--r--zellij-utils/src/plugin_api/action.rs14
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap1
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap1
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap1
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap1
11 files changed, 187 insertions, 7 deletions
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
index ee2b6da1..e09755e0 100644
--- a/zellij-utils/src/cli.rs
+++ b/zellij-utils/src/cli.rs
@@ -520,6 +520,11 @@ pub enum Sessions {
/// if set, will open the pane near the current one rather than following the user's focus
#[clap(long)]
near_current_pane: bool,
+ #[clap(
+ long,
+ help = "if set, will open the pane without changing the focus of any client, placing it relative to the pane the command was issued from"
+ )]
+ no_focus: bool,
/// start this pane without a border (warning: will make it impossible to move with the
/// mouse)
#[clap(short, long, value_parser)]
@@ -588,6 +593,11 @@ pub enum Sessions {
/// Whether to pin a floating pane so that it is always on top
#[clap(long, requires("floating"))]
pinned: Option<bool>,
+ #[clap(
+ long,
+ help = "if set, will open the plugin pane without changing the focus of any client, placing it relative to the pane the command was issued from"
+ )]
+ no_focus: bool,
/// start this pane without a border (warning: will make it impossible to move with the
/// mouse)
#[clap(short, long, value_parser)]
@@ -657,6 +667,11 @@ pub enum Sessions {
/// if set, will open the pane near the current one rather than following the user's focus
#[clap(long)]
near_current_pane: bool,
+ #[clap(
+ long,
+ help = "if set, will open the pane without changing the focus of any client, placing it relative to the pane the command was issued from"
+ )]
+ no_focus: bool,
/// start this pane without a border (warning: will make it impossible to move with the
/// mouse)
#[clap(short, long, value_parser)]
@@ -1050,6 +1065,11 @@ pub enum CliAction {
/// if set, will open the pane near the current one rather than following the user's focus
#[clap(long)]
near_current_pane: bool,
+ #[clap(
+ long,
+ help = "if set, will open the pane without changing the focus of any client, placing it relative to the pane the command was issued from"
+ )]
+ no_focus: bool,
/// start this pane without a border (warning: will make it impossible to move with the
/// mouse)
#[clap(long, value_parser)]
@@ -1123,6 +1143,11 @@ pub enum CliAction {
/// if set, will open the pane near the current one rather than following the user's focus
#[clap(long)]
near_current_pane: bool,
+ #[clap(
+ long,
+ help = "if set, will open the pane without changing the focus of any client, placing it relative to the pane the command was issued from"
+ )]
+ no_focus: bool,
/// start this pane without a border (warning: will make it impossible to move with the
/// mouse)
#[clap(short, long, value_parser)]
@@ -1335,6 +1360,12 @@ pub enum CliAction {
conflicts_with("block-until-exit-failure")
)]
block_until_exit: bool,
+
+ #[clap(
+ long,
+ help = "if set, will create the tab without changing the focus of any client"
+ )]
+ no_focus: bool,
},
/// Move the focused tab in the specified direction. [right|left]
MoveTab {
@@ -1437,6 +1468,11 @@ pub enum CliAction {
configuration: Option<PluginUserConfiguration>,
#[clap(short, long, value_parser)]
skip_plugin_cache: bool,
+ #[clap(
+ long,
+ help = "if set, will open the plugin pane without changing the focus of any client"
+ )]
+ no_focus: bool,
/// Target a specific tab by ID
#[clap(long, value_parser, conflicts_with("in-place"))]
tab_id: Option<usize>,
diff --git a/zellij-utils/src/client_server_contract/common_types.proto b/zellij-utils/src/client_server_contract/common_types.proto
index 14f8eda0..4c2f8395 100644
--- a/zellij-utils/src/client_server_contract/common_types.proto
+++ b/zellij-utils/src/client_server_contract/common_types.proto
@@ -469,6 +469,7 @@ message EditFileAction {
bool near_current_pane = 7;
bool close_replaced_pane = 8;
optional uint32 tab_id = 9;
+ bool no_focus = 10;
}
message NewFloatingPaneAction {
@@ -477,6 +478,7 @@ message NewFloatingPaneAction {
optional FloatingPaneCoordinates coordinates = 3;
bool near_current_pane = 7;
optional uint32 tab_id = 8;
+ bool no_focus = 9;
}
message NewTiledPaneAction {
@@ -486,6 +488,7 @@ message NewTiledPaneAction {
bool near_current_pane = 7;
optional bool borderless = 8;
optional uint32 tab_id = 9;
+ bool no_focus = 10;
}
message NewInPlacePaneAction {
@@ -495,6 +498,7 @@ message NewInPlacePaneAction {
optional PaneId pane_id_to_replace = 4;
bool close_replaced_pane = 5;
optional uint32 tab_id = 6;
+ bool no_focus = 7;
}
message NewStackedPaneAction {
@@ -502,6 +506,7 @@ message NewStackedPaneAction {
optional string pane_name = 2;
bool near_current_pane = 3;
optional uint32 tab_id = 4;
+ bool no_focus = 5;
}
message NewBlockingPaneAction {
@@ -511,6 +516,7 @@ message NewBlockingPaneAction {
optional UnblockCondition unblock_condition = 4;
bool near_current_pane = 5;
optional uint32 tab_id = 6;
+ bool no_focus = 7;
}
message PaneNameInputAction {
@@ -549,6 +555,7 @@ message MoveTabAction {
message RunAction {
RunCommandAction command = 1;
bool near_current_pane = 2;
+ bool no_focus = 3;
}
message LaunchOrFocusPluginAction {
@@ -569,6 +576,7 @@ message LaunchPluginAction {
optional string cwd = 5;
bool close_replaced_pane = 6;
optional uint32 tab_id = 7;
+ bool no_focus = 8;
}
message MouseEventAction {
@@ -597,6 +605,7 @@ message NewTiledPluginPaneAction {
bool skip_cache = 3;
optional string cwd = 4;
optional uint32 tab_id = 5;
+ bool no_focus = 6;
}
message NewFloatingPluginPaneAction {
@@ -606,6 +615,7 @@ message NewFloatingPluginPaneAction {
optional string cwd = 4;
optional FloatingPaneCoordinates coordinates = 5;
optional uint32 tab_id = 6;
+ bool no_focus = 7;
}
message NewInPlacePluginPaneAction {
@@ -614,6 +624,7 @@ message NewInPlacePluginPaneAction {
bool skip_cache = 3;
bool close_replaced_pane = 4;
optional uint32 tab_id = 5;
+ bool no_focus = 6;
}
message StartOrReloadPluginAction {
diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs
index 757e99e4..c0e953b6 100644
--- a/zellij-utils/src/input/actions.rs
+++ b/zellij-utils/src/input/actions.rs
@@ -235,6 +235,7 @@ pub enum Action {
command: Option<RunCommandAction>,
unblock_condition: Option<UnblockCondition>,
near_current_pane: bool,
+ no_focus: bool,
tab_id: Option<usize>,
},
/// Open the file in a new pane using the default editor
@@ -248,6 +249,7 @@ pub enum Action {
start_suppressed: bool,
coordinates: Option<FloatingPaneCoordinates>,
near_current_pane: bool,
+ no_focus: bool,
tab_id: Option<usize>,
},
/// Open a new floating pane
@@ -257,6 +259,7 @@ pub enum Action {
pane_name: Option<String>,
coordinates: Option<FloatingPaneCoordinates>,
near_current_pane: bool,
+ no_focus: bool,
tab_id: Option<usize>,
},
/// Open a new tiled (embedded, non-floating) pane
@@ -266,6 +269,7 @@ pub enum Action {
command: Option<RunCommandAction>,
pane_name: Option<String>,
near_current_pane: bool,
+ no_focus: bool,
borderless: Option<bool>,
tab_id: Option<usize>,
},
@@ -275,6 +279,7 @@ pub enum Action {
command: Option<RunCommandAction>,
pane_name: Option<String>,
near_current_pane: bool,
+ no_focus: bool,
pane_id_to_replace: Option<PaneId>,
close_replaced_pane: bool,
tab_id: Option<usize>,
@@ -284,6 +289,7 @@ pub enum Action {
command: Option<RunCommandAction>,
pane_name: Option<String>,
near_current_pane: bool,
+ no_focus: bool,
tab_id: Option<usize>,
},
/// Embed focused pane in tab if floating or float focused pane if embedded
@@ -347,6 +353,7 @@ pub enum Action {
Run {
command: RunCommandAction,
near_current_pane: bool,
+ no_focus: bool,
},
/// Set pane default foreground/background color
SetPaneColor {
@@ -388,6 +395,7 @@ pub enum Action {
close_replaced_pane: bool,
skip_cache: bool,
cwd: Option<PathBuf>,
+ no_focus: bool,
tab_id: Option<usize>,
},
MouseEvent {
@@ -434,6 +442,7 @@ pub enum Action {
pane_name: Option<String>,
skip_cache: bool,
cwd: Option<PathBuf>,
+ no_focus: bool,
tab_id: Option<usize>,
},
/// Returns: Created pane ID (format: plugin_<id>)
@@ -443,6 +452,7 @@ pub enum Action {
skip_cache: bool,
cwd: Option<PathBuf>,
coordinates: Option<FloatingPaneCoordinates>,
+ no_focus: bool,
tab_id: Option<usize>,
},
/// Returns: Created pane ID (format: plugin_<id>)
@@ -451,6 +461,7 @@ pub enum Action {
pane_name: Option<String>,
skip_cache: bool,
close_replaced_pane: bool,
+ no_focus: bool,
tab_id: Option<usize>,
},
StartOrReloadPlugin {
@@ -1039,6 +1050,7 @@ impl Action {
block_until_exit,
unblock_condition,
near_current_pane,
+ no_focus,
borderless,
tab_id,
} => {
@@ -1124,6 +1136,7 @@ impl Action {
command,
unblock_condition,
near_current_pane,
+ no_focus,
tab_id,
}])
} else if let Some(plugin) = plugin {
@@ -1156,6 +1169,7 @@ impl Action {
coordinates: FloatingPaneCoordinates::new(
x, y, width, height, pinned, borderless,
),
+ no_focus,
tab_id,
}])
} else if in_place {
@@ -1164,6 +1178,7 @@ impl Action {
pane_name: name,
skip_cache: skip_plugin_cache,
close_replaced_pane,
+ no_focus,
tab_id,
}])
} else {
@@ -1180,6 +1195,7 @@ impl Action {
pane_name: name,
skip_cache: skip_plugin_cache,
cwd,
+ no_focus,
tab_id,
}])
}
@@ -1205,6 +1221,7 @@ impl Action {
x, y, width, height, pinned, borderless,
),
near_current_pane,
+ no_focus,
tab_id,
}])
} else if in_place {
@@ -1212,6 +1229,7 @@ impl Action {
command: Some(run_command_action),
pane_name: name,
near_current_pane,
+ no_focus,
pane_id_to_replace,
close_replaced_pane,
tab_id,
@@ -1221,6 +1239,7 @@ impl Action {
command: Some(run_command_action),
pane_name: name,
near_current_pane,
+ no_focus,
tab_id,
}])
} else {
@@ -1229,6 +1248,7 @@ impl Action {
command: Some(run_command_action),
pane_name: name,
near_current_pane,
+ no_focus,
borderless,
tab_id,
}])
@@ -1242,6 +1262,7 @@ impl Action {
x, y, width, height, pinned, borderless,
),
near_current_pane,
+ no_focus,
tab_id,
}])
} else if in_place {
@@ -1249,6 +1270,7 @@ impl Action {
command: None,
pane_name: name,
near_current_pane,
+ no_focus,
pane_id_to_replace,
close_replaced_pane,
tab_id,
@@ -1258,6 +1280,7 @@ impl Action {
command: None,
pane_name: name,
near_current_pane,
+ no_focus,
tab_id,
}])
} else {
@@ -1266,6 +1289,7 @@ impl Action {
command: None,
pane_name: name,
near_current_pane,
+ no_focus,
borderless,
tab_id,
}])
@@ -1286,6 +1310,7 @@ impl Action {
height,
pinned,
near_current_pane,
+ no_focus,
borderless,
tab_id,
} => {
@@ -1311,6 +1336,7 @@ impl Action {
x, y, width, height, pinned, borderless,
),
near_current_pane,
+ no_focus,
tab_id,
}])
},
@@ -1414,6 +1440,7 @@ impl Action {
block_until_exit_success,
block_until_exit_failure,
block_until_exit,
+ no_focus,
} => {
let current_dir = get_current_dir();
let cwd = cwd
@@ -1520,8 +1547,8 @@ impl Action {
.any(|(_, layout, _)| layout.focus.unwrap_or(false));
for (tab_name, layout, floating_panes_layout) in tabs.drain(..) {
let name = tab_name.or_else(|| name.clone());
- let should_change_focus_to_new_tab =
- layout.focus.unwrap_or_else(|| {
+ let should_change_focus_to_new_tab = !no_focus
+ && layout.focus.unwrap_or_else(|| {
if !has_focused_tab {
has_focused_tab = true;
true
@@ -1546,7 +1573,7 @@ impl Action {
let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone());
let swap_floating_layouts = Some(layout.swap_floating_layouts.clone());
let (layout, floating_panes_layout) = layout.new_tab();
- let should_change_focus_to_new_tab = true;
+ let should_change_focus_to_new_tab = !no_focus;
Ok(vec![Action::NewTab {
tiled_layout: Some(layout),
floating_layouts: floating_panes_layout,
@@ -1636,8 +1663,8 @@ impl Action {
.any(|(_, layout, _)| layout.focus.unwrap_or(false));
for (tab_name, layout, floating_panes_layout) in tabs.drain(..) {
let name = tab_name.or_else(|| name.clone());
- let should_change_focus_to_new_tab =
- layout.focus.unwrap_or_else(|| {
+ let should_change_focus_to_new_tab = !no_focus
+ && layout.focus.unwrap_or_else(|| {
if !has_focused_tab {
has_focused_tab = true;
true
@@ -1662,7 +1689,7 @@ impl Action {
let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone());
let swap_floating_layouts = Some(layout.swap_floating_layouts.clone());
let (layout, floating_panes_layout) = layout.new_tab();
- let should_change_focus_to_new_tab = true;
+ let should_change_focus_to_new_tab = !no_focus;
Ok(vec![Action::NewTab {
tiled_layout: Some(layout),
floating_layouts: floating_panes_layout,
@@ -1676,7 +1703,7 @@ impl Action {
}])
}
} else {
- let should_change_focus_to_new_tab = true;
+ let should_change_focus_to_new_tab = !no_focus;
Ok(vec![Action::NewTab {
tiled_layout: None,
floating_layouts: vec![],
@@ -1854,6 +1881,7 @@ impl Action {
close_replaced_pane,
configuration,
skip_plugin_cache,
+ no_focus,
tab_id,
} => {
let current_dir = get_current_dir();
@@ -1870,6 +1898,7 @@ impl Action {
close_replaced_pane,
skip_cache: skip_plugin_cache,
cwd: Some(current_dir),
+ no_focus,
tab_id,
}])
},
@@ -3474,6 +3503,7 @@ mod tests {
block_until_exit: false,
block_until_exit_success: false,
block_until_exit_failure: false,
+ no_focus: false,
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_ok());
@@ -3510,6 +3540,7 @@ mod tests {
block_until_exit: false,
block_until_exit_success: false,
block_until_exit_failure: false,
+ no_focus: false,
};
let result = Action::actions_from_cli(cli_action, Box::new(|| PathBuf::from("/tmp")), None);
assert!(result.is_err());
@@ -3608,6 +3639,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(3),
};
@@ -3651,6 +3683,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: None,
};
@@ -3694,6 +3727,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: None,
};
@@ -3739,6 +3773,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: None,
};
@@ -3775,6 +3810,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(5),
};
@@ -3818,6 +3854,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(1),
};
@@ -3861,6 +3898,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(2),
};
@@ -3892,6 +3930,7 @@ mod tests {
height: None,
pinned: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(4),
};
@@ -3923,6 +3962,7 @@ mod tests {
height: None,
pinned: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: None,
};
@@ -3966,6 +4006,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(2),
};
@@ -4009,6 +4050,7 @@ mod tests {
block_until_exit: false,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(1),
};
diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs
index 1f625ddd..ebaae103 100644
--- a/zellij-utils/src/ipc/protobuf_conversion.rs
+++ b/zellij-utils/src/ipc/protobuf_conversion.rs
@@ -1225,6 +1225,7 @@ impl From<crate::input::actions::Action>
start_suppressed,
coordinates,
near_current_pane,
+ no_focus,
tab_id,
..
} => ActionType::EditFile(EditFileAction {
@@ -1237,12 +1238,14 @@ impl From<crate::input::actions::Action>
coordinates: coordinates.map(|c| c.into()),
near_current_pane,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewFloatingPane {
command,
pane_name,
coordinates,
near_current_pane,
+ no_focus,
tab_id,
..
} => ActionType::NewFloatingPane(NewFloatingPaneAction {
@@ -1251,12 +1254,14 @@ impl From<crate::input::actions::Action>
coordinates: coordinates.map(|c| c.into()),
near_current_pane,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewTiledPane {
direction,
command,
pane_name,
near_current_pane,
+ no_focus,
borderless,
tab_id,
..
@@ -1267,11 +1272,13 @@ impl From<crate::input::actions::Action>
near_current_pane,
borderless,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewInPlacePane {
command,
pane_name,
near_current_pane,
+ no_focus,
pane_id_to_replace,
close_replaced_pane,
tab_id,
@@ -1283,11 +1290,13 @@ impl From<crate::input::actions::Action>
pane_id_to_replace: pane_id_to_replace.and_then(|p| p.try_into().ok()),
close_replaced_pane,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewStackedPane {
command,
pane_name,
near_current_pane,
+ no_focus,
tab_id,
..
} => ActionType::NewStackedPane(NewStackedPaneAction {
@@ -1295,6 +1304,7 @@ impl From<crate::input::actions::Action>
pane_name,
near_current_pane,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewBlockingPane {
placement,
@@ -1302,6 +1312,7 @@ impl From<crate::input::actions::Action>
command,
unblock_condition,
near_current_pane,
+ no_focus,
tab_id,
..
} => ActionType::NewBlockingPane(NewBlockingPaneAction {
@@ -1311,6 +1322,7 @@ impl From<crate::input::actions::Action>
unblock_condition: unblock_condition.map(|c| unblock_condition_to_proto_i32(c)),
near_current_pane,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::TogglePaneEmbedOrFloating => {
ActionType::TogglePaneEmbedOrFloating(TogglePaneEmbedOrFloatingAction {})
@@ -1403,9 +1415,11 @@ impl From<crate::input::actions::Action>
crate::input::actions::Action::Run {
command,
near_current_pane,
+ no_focus,
} => ActionType::Run(RunAction {
command: Some(command.into()),
near_current_pane,
+ no_focus,
}),
crate::input::actions::Action::Detach => ActionType::Detach(DetachAction {}),
crate::input::actions::Action::SetDarkTheme => {
@@ -1458,6 +1472,7 @@ impl From<crate::input::actions::Action>
close_replaced_pane,
skip_cache,
cwd,
+ no_focus,
tab_id,
..
} => ActionType::LaunchPlugin(LaunchPluginAction {
@@ -1468,6 +1483,7 @@ impl From<crate::input::actions::Action>
skip_cache,
cwd: cwd.map(|p| p.to_string_lossy().to_string()),
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::MouseEvent { event } => {
ActionType::MouseEvent(MouseEventAction {
@@ -1528,6 +1544,7 @@ impl From<crate::input::actions::Action>
pane_name,
skip_cache,
cwd,
+ no_focus,
tab_id,
..
} => ActionType::NewTiledPluginPane(NewTiledPluginPaneAction {
@@ -1536,6 +1553,7 @@ impl From<crate::input::actions::Action>
skip_cache,
cwd: cwd.map(|p| p.to_string_lossy().to_string()),
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewFloatingPluginPane {
plugin,
@@ -1543,6 +1561,7 @@ impl From<crate::input::actions::Action>
skip_cache,
cwd,
coordinates,
+ no_focus,
tab_id,
..
} => ActionType::NewFloatingPluginPane(NewFloatingPluginPaneAction {
@@ -1552,12 +1571,14 @@ impl From<crate::input::actions::Action>
cwd: cwd.map(|p| p.to_string_lossy().to_string()),
coordinates: coordinates.map(|c| c.into()),
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::NewInPlacePluginPane {
plugin,
pane_name,
skip_cache,
close_replaced_pane,
+ no_focus,
tab_id,
..
} => ActionType::NewInPlacePluginPane(NewInPlacePluginPaneAction {
@@ -1566,6 +1587,7 @@ impl From<crate::input::actions::Action>
skip_cache,
close_replaced_pane,
tab_id: tab_id.map(|t| t as u32),
+ no_focus,
}),
crate::input::actions::Action::StartOrReloadPlugin { plugin } => {
ActionType::StartOrReloadPlugin(StartOrReloadPluginAction {
@@ -2099,6 +2121,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.map(|c| c.try_into())
.transpose()?,
near_current_pane: edit_file_action.near_current_pane,
+ no_focus: edit_file_action.no_focus,
tab_id: edit_file_action.tab_id.map(|t| t as usize),
}),
ActionType::NewFloatingPane(new_floating_action) => {
@@ -2113,6 +2136,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.map(|c| c.try_into())
.transpose()?,
near_current_pane: new_floating_action.near_current_pane,
+ no_focus: new_floating_action.no_focus,
tab_id: new_floating_action.tab_id.map(|t| t as usize),
})
},
@@ -2125,6 +2149,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
command: new_tiled_action.command.map(|c| c.try_into()).transpose()?,
pane_name: new_tiled_action.pane_name,
near_current_pane: new_tiled_action.near_current_pane,
+ no_focus: new_tiled_action.no_focus,
borderless: new_tiled_action.borderless,
tab_id: new_tiled_action.tab_id.map(|t| t as usize),
})
@@ -2137,6 +2162,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.transpose()?,
pane_name: new_in_place_action.pane_name,
near_current_pane: new_in_place_action.near_current_pane,
+ no_focus: new_in_place_action.no_focus,
pane_id_to_replace: new_in_place_action
.pane_id_to_replace
.and_then(|p| p.try_into().ok()),
@@ -2152,6 +2178,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.transpose()?,
pane_name: new_stacked_action.pane_name,
near_current_pane: new_stacked_action.near_current_pane,
+ no_focus: new_stacked_action.no_focus,
tab_id: new_stacked_action.tab_id.map(|t| t as usize),
})
},
@@ -2171,6 +2198,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.map(|c| proto_i32_to_unblock_condition(c))
.transpose()?,
near_current_pane: new_blocking_action.near_current_pane,
+ no_focus: new_blocking_action.no_focus,
tab_id: new_blocking_action.tab_id.map(|t| t as usize),
})
},
@@ -2287,6 +2315,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.ok_or_else(|| anyhow!("Run missing command"))?
.try_into()?,
near_current_pane: run_action.near_current_pane,
+ no_focus: run_action.no_focus,
}),
ActionType::Detach(_) => Ok(crate::input::actions::Action::Detach),
ActionType::SetDarkTheme(_) => Ok(crate::input::actions::Action::SetDarkTheme),
@@ -2332,6 +2361,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
close_replaced_pane: launch_plugin_action.close_replaced_pane,
skip_cache: launch_plugin_action.skip_cache,
cwd: launch_plugin_action.cwd.map(PathBuf::from),
+ no_focus: launch_plugin_action.no_focus,
tab_id: launch_plugin_action.tab_id.map(|t| t as usize),
})
},
@@ -2405,6 +2435,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
pane_name: new_tiled_plugin_action.pane_name,
skip_cache: new_tiled_plugin_action.skip_cache,
cwd: new_tiled_plugin_action.cwd.map(PathBuf::from),
+ no_focus: new_tiled_plugin_action.no_focus,
tab_id: new_tiled_plugin_action.tab_id.map(|t| t as usize),
})
},
@@ -2421,6 +2452,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.coordinates
.map(|c| c.try_into())
.transpose()?,
+ no_focus: new_floating_plugin_action.no_focus,
tab_id: new_floating_plugin_action.tab_id.map(|t| t as usize),
})
},
@@ -2433,6 +2465,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
pane_name: new_in_place_plugin_action.pane_name,
skip_cache: new_in_place_plugin_action.skip_cache,
close_replaced_pane: new_in_place_plugin_action.close_replaced_pane,
+ no_focus: new_in_place_plugin_action.no_focus,
tab_id: new_in_place_plugin_action.tab_id.map(|t| t as usize),
})
},
diff --git a/zellij-utils/src/ipc/tests/roundtrip_tests.rs b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
index 4f9d57ac..db0b8fc1 100644
--- a/zellij-utils/src/ipc/tests/roundtrip_tests.rs
+++ b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
@@ -1059,6 +1059,7 @@ fn test_client_messages() {
start_suppressed: false,
coordinates: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1084,6 +1085,7 @@ fn test_client_messages() {
start_suppressed: false,
coordinates: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1109,6 +1111,7 @@ fn test_client_messages() {
start_suppressed: false,
coordinates: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1134,6 +1137,7 @@ fn test_client_messages() {
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(None, None, None, None, None, Some(false)),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1166,6 +1170,7 @@ fn test_client_messages() {
Some(false),
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1198,6 +1203,7 @@ fn test_client_messages() {
Some(false),
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1230,6 +1236,7 @@ fn test_client_messages() {
Some(false),
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1262,6 +1269,7 @@ fn test_client_messages() {
Some(false)
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1274,6 +1282,7 @@ fn test_client_messages() {
pane_name: None,
coordinates: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1302,6 +1311,7 @@ fn test_client_messages() {
Some(false),
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1334,6 +1344,7 @@ fn test_client_messages() {
Some(false),
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1346,6 +1357,7 @@ fn test_client_messages() {
direction: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: None,
},
@@ -1372,6 +1384,7 @@ fn test_client_messages() {
direction: Some(Direction::Right),
pane_name: Some("my_pane_name".to_owned()),
near_current_pane: false,
+ no_focus: false,
borderless: Some(true),
tab_id: None,
},
@@ -1397,6 +1410,7 @@ fn test_client_messages() {
}),
pane_name: Some("my_pane_name".to_owned()),
near_current_pane: false,
+ no_focus: false,
pane_id_to_replace: None,
close_replaced_pane: false,
tab_id: None,
@@ -1410,6 +1424,7 @@ fn test_client_messages() {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
pane_id_to_replace: None,
close_replaced_pane: false,
tab_id: None,
@@ -1436,6 +1451,7 @@ fn test_client_messages() {
}),
pane_name: Some("my_pane_name".to_owned()),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -1447,6 +1463,7 @@ fn test_client_messages() {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -2249,6 +2266,7 @@ fn test_client_messages() {
use_terminal_title: false,
},
near_current_pane: false,
+ no_focus: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2296,6 +2314,7 @@ fn test_client_messages() {
close_replaced_pane: false,
skip_cache: true,
cwd: None,
+ no_focus: true,
tab_id: None,
},
terminal_id: Some(1),
@@ -2310,6 +2329,7 @@ fn test_client_messages() {
close_replaced_pane: false,
skip_cache: false,
cwd: Some(PathBuf::from("/path/to/cwd")),
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -2483,6 +2503,7 @@ fn test_client_messages() {
pane_name: Some("my_pane_name".to_owned()),
skip_cache: false,
cwd: Some(PathBuf::from("relative/path/to/cwd")),
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -2496,6 +2517,7 @@ fn test_client_messages() {
skip_cache: true,
cwd: Some(PathBuf::from("relative/path/to/cwd")),
coordinates: None,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -2516,6 +2538,7 @@ fn test_client_messages() {
Some(true),
Some(false),
),
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -2528,6 +2551,7 @@ fn test_client_messages() {
pane_name: Some("my_pane_name".to_owned()),
skip_cache: true,
close_replaced_pane: false,
+ no_focus: false,
tab_id: None,
},
terminal_id: Some(1),
@@ -2540,6 +2564,7 @@ fn test_client_messages() {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: Some(3),
},
@@ -2553,6 +2578,7 @@ fn test_client_messages() {
pane_name: None,
coordinates: None,
near_current_pane: false,
+ no_focus: false,
tab_id: Some(5),
},
terminal_id: Some(1),
@@ -2564,6 +2590,7 @@ fn test_client_messages() {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: Some(2),
},
terminal_id: Some(1),
@@ -2580,6 +2607,7 @@ fn test_client_messages() {
command: None,
unblock_condition: None,
near_current_pane: false,
+ no_focus: false,
tab_id: Some(1),
},
terminal_id: Some(1),
@@ -2601,6 +2629,7 @@ fn test_client_messages() {
start_suppressed: false,
coordinates: None,
near_current_pane: false,
+ no_focus: false,
tab_id: Some(4),
},
terminal_id: Some(1),
@@ -2612,6 +2641,7 @@ fn test_client_messages() {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
pane_id_to_replace: None,
close_replaced_pane: false,
tab_id: Some(7),
@@ -2642,6 +2672,7 @@ fn test_client_messages() {
close_replaced_pane: false,
skip_cache: false,
cwd: None,
+ no_focus: false,
tab_id: Some(6),
},
terminal_id: Some(1),
@@ -2654,6 +2685,7 @@ fn test_client_messages() {
pane_name: None,
skip_cache: false,
cwd: None,
+ no_focus: false,
tab_id: Some(1),
},
terminal_id: Some(1),
@@ -2667,6 +2699,7 @@ fn test_client_messages() {
skip_cache: false,
cwd: None,
coordinates: None,
+ no_focus: false,
tab_id: Some(3),
},
terminal_id: Some(1),
@@ -2679,6 +2712,7 @@ fn test_client_messages() {
pane_name: None,
skip_cache: false,
close_replaced_pane: false,
+ no_focus: false,
tab_id: Some(2),
},
terminal_id: Some(1),
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index 30495d5f..94848e63 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -573,6 +573,7 @@ impl Action {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
});
} else {
@@ -2038,6 +2039,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
x, y, width, height, pinned, borderless,
),
near_current_pane: false,
+ no_focus: false,
tab_id: None,
})
} else if in_place {
@@ -2045,6 +2047,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
command: Some(run_command_action),
pane_name: name,
near_current_pane: false,
+ no_focus: false,
pane_id_to_replace: None,
close_replaced_pane,
tab_id: None,
@@ -2054,6 +2057,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
command: Some(run_command_action),
pane_name: name,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
})
} else {
@@ -2062,6 +2066,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
command: Some(run_command_action),
pane_name: name,
near_current_pane: false,
+ no_focus: false,
borderless: None,
tab_id: None,
})
@@ -2171,6 +2176,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
skip_cache: skip_plugin_cache,
cwd: None, // we explicitly do not send the current dir here so that it will be
// filled from the active pane == better UX
+ no_focus: false,
tab_id: None,
})
},
diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs
index 209bff3f..f1d71222 100644
--- a/zellij-utils/src/plugin_api/action.rs
+++ b/zellij-utils/src/plugin_api/action.rs
@@ -355,6 +355,7 @@ impl TryFrom<ProtobufAction> for Action {
start_suppressed: false,
coordinates: None,
near_current_pane,
+ no_focus: false,
tab_id: None,
})
},
@@ -371,6 +372,7 @@ impl TryFrom<ProtobufAction> for Action {
pane_name,
coordinates: None,
near_current_pane,
+ no_focus: false,
tab_id: None,
})
} else {
@@ -379,6 +381,7 @@ impl TryFrom<ProtobufAction> for Action {
pane_name: None,
coordinates: None,
near_current_pane,
+ no_focus: false,
tab_id: None,
})
}
@@ -401,6 +404,7 @@ impl TryFrom<ProtobufAction> for Action {
command: Some(run_command_action),
pane_name,
near_current_pane,
+ no_focus: false,
borderless,
tab_id: None,
})
@@ -410,6 +414,7 @@ impl TryFrom<ProtobufAction> for Action {
command: None,
pane_name: None,
near_current_pane,
+ no_focus: false,
borderless,
tab_id: None,
})
@@ -620,6 +625,7 @@ impl TryFrom<ProtobufAction> for Action {
Ok(Action::Run {
command: run_command_action,
near_current_pane: false,
+ no_focus: false,
})
},
_ => Err("Wrong payload for Action::Run"),
@@ -723,6 +729,7 @@ impl TryFrom<ProtobufAction> for Action {
close_replaced_pane: false,
skip_cache: skip_plugin_cache,
cwd: None,
+ no_focus: false,
tab_id: None,
})
},
@@ -843,6 +850,7 @@ impl TryFrom<ProtobufAction> for Action {
pane_name,
skip_cache: skip_plugin_cache,
cwd: None,
+ no_focus: false,
tab_id: None,
})
},
@@ -869,6 +877,7 @@ impl TryFrom<ProtobufAction> for Action {
skip_cache: skip_plugin_cache,
cwd: None,
coordinates: None,
+ no_focus: false,
tab_id: None,
})
},
@@ -1022,6 +1031,7 @@ impl TryFrom<ProtobufAction> for Action {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
}),
},
@@ -1044,6 +1054,7 @@ impl TryFrom<ProtobufAction> for Action {
command,
unblock_condition,
near_current_pane,
+ no_focus: false,
tab_id: None,
})
},
@@ -1062,6 +1073,7 @@ impl TryFrom<ProtobufAction> for Action {
command: Some(run_command_action),
pane_name,
near_current_pane,
+ no_focus: false,
pane_id_to_replace,
close_replaced_pane,
tab_id: None,
@@ -1071,6 +1083,7 @@ impl TryFrom<ProtobufAction> for Action {
command: None,
pane_name: payload.pane_name,
near_current_pane,
+ no_focus: false,
pane_id_to_replace,
close_replaced_pane,
tab_id: None,
@@ -1598,6 +1611,7 @@ impl TryFrom<Action> for ProtobufAction {
Action::Run {
command: run_command_action,
near_current_pane: _,
+ no_focus: _,
} => {
let run_command_action: ProtobufRunCommandAction = run_command_action.try_into()?;
Ok(ProtobufAction {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap
index 5a35fe4e..9b6ac7fe 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap
@@ -1349,6 +1349,7 @@ Config {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
SwitchToMode {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap
index 83046edf..6c210eeb 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap
@@ -1349,6 +1349,7 @@ Config {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
SwitchToMode {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap
index 7ae735ab..7f1625d3 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap
@@ -1349,6 +1349,7 @@ Config {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
SwitchToMode {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap
index f0391d92..c7db95cd 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap
@@ -1349,6 +1349,7 @@ Config {
command: None,
pane_name: None,
near_current_pane: false,
+ no_focus: false,
tab_id: None,
},
SwitchToMode {