diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-01-20 17:11:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-20 17:11:26 +0100 |
| commit | 432c6d749121bc2d8fa3361b59c5d14cbd82a0e0 (patch) | |
| tree | ca8f61fa7ed151681d5f3220bdf91a100139306c /zellij-utils/src/plugin_api | |
| parent | Allow toggling pane frames for specific panes (#4615) (diff) | |
| download | sl0ppij-432c6d749121bc2d8fa3361b59c5d14cbd82a0e0.tar.gz sl0ppij-432c6d749121bc2d8fa3361b59c5d14cbd82a0e0.tar.xz sl0ppij-432c6d749121bc2d8fa3361b59c5d14cbd82a0e0.zip | |
Fix tiled new pane borderless (#4618)
* allow opening tiled pane as borderless
* rustfmt
* add pr
* fix e2e tests
Diffstat (limited to 'zellij-utils/src/plugin_api')
| -rw-r--r-- | zellij-utils/src/plugin_api/action.proto | 10 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/action.rs | 43 |
2 files changed, 45 insertions, 8 deletions
diff --git a/zellij-utils/src/plugin_api/action.proto b/zellij-utils/src/plugin_api/action.proto index f8061bb6..802d0a0e 100644 --- a/zellij-utils/src/plugin_api/action.proto +++ b/zellij-utils/src/plugin_api/action.proto @@ -298,6 +298,7 @@ message NewTiledPanePayload { optional RunCommandAction command = 1; optional resize.ResizeDirection direction = 2; bool near_current_pane = 3; + optional bool borderless = 4; } message MovePanePayload { @@ -499,7 +500,7 @@ enum UnblockCondition { // NewPanePlacement specifies where a new pane should be placed message NewPanePlacement { oneof placement_variant { - bool no_preference = 1; + NoPreferenceOptions no_preference = 1; TiledPlacement tiled = 2; FloatingPlacement floating = 3; InPlaceConfig in_place = 4; @@ -507,8 +508,13 @@ message NewPanePlacement { } } +message NoPreferenceOptions { + optional bool borderless = 1; +} + message TiledPlacement { optional resize.ResizeDirection direction = 1; + optional bool borderless = 2; } message FloatingPlacement { @@ -518,10 +524,12 @@ message FloatingPlacement { message InPlaceConfig { optional PaneId pane_id_to_replace = 1; bool close_replaced_pane = 2; + optional bool borderless = 3; } message StackedPlacement { optional PaneId pane_id = 1; + optional bool borderless = 2; } message MouseEventPayload { diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs index 2253d526..bc5bc87c 100644 --- a/zellij-utils/src/plugin_api/action.rs +++ b/zellij-utils/src/plugin_api/action.rs @@ -360,6 +360,7 @@ impl TryFrom<ProtobufAction> for Action { .and_then(|d| ProtobufResizeDirection::from_i32(d)) .and_then(|d| d.try_into().ok()); let near_current_pane = payload.near_current_pane; + let borderless = payload.borderless; if let Some(payload) = payload.command { let pane_name = payload.pane_name.clone(); let run_command_action: RunCommandAction = payload.try_into()?; @@ -368,6 +369,7 @@ impl TryFrom<ProtobufAction> for Action { command: Some(run_command_action), pane_name, near_current_pane, + borderless, }) } else { Ok(Action::NewTiledPane { @@ -375,6 +377,7 @@ impl TryFrom<ProtobufAction> for Action { command: None, pane_name: None, near_current_pane, + borderless, }) } }, @@ -1255,6 +1258,7 @@ impl TryFrom<Action> for ProtobufAction { command: run_command_action, pane_name, near_current_pane, + borderless, } => { let direction = direction.and_then(|direction| { let protobuf_direction: ProtobufResizeDirection = direction.try_into().ok()?; @@ -1274,6 +1278,7 @@ impl TryFrom<Action> for ProtobufAction { direction, command, near_current_pane, + borderless, }, )), }) @@ -2276,13 +2281,18 @@ impl TryFrom<ProtobufNewPanePlacement> for NewPanePlacement { use super::generated_api::api::action::new_pane_placement::PlacementVariant; match protobuf_placement.placement_variant { - Some(PlacementVariant::NoPreference(_)) => Ok(NewPanePlacement::NoPreference), + Some(PlacementVariant::NoPreference(opts)) => Ok(NewPanePlacement::NoPreference { + borderless: opts.borderless, + }), Some(PlacementVariant::Tiled(tiled)) => { let direction = tiled .direction .and_then(|d| ProtobufResizeDirection::from_i32(d)) .and_then(|d| d.try_into().ok()); - Ok(NewPanePlacement::Tiled(direction)) + Ok(NewPanePlacement::Tiled { + direction, + borderless: tiled.borderless, + }) }, Some(PlacementVariant::Floating(floating)) => { let coords = floating.coordinates.and_then(|c| c.try_into().ok()); @@ -2294,11 +2304,15 @@ impl TryFrom<ProtobufNewPanePlacement> for NewPanePlacement { Ok(NewPanePlacement::InPlace { pane_id_to_replace, close_replaced_pane: config.close_replaced_pane, + borderless: config.borderless, }) }, Some(PlacementVariant::Stacked(stacked)) => { let pane_id = stacked.pane_id.and_then(|id| id.try_into().ok()); - Ok(NewPanePlacement::Stacked(pane_id)) + Ok(NewPanePlacement::Stacked { + pane_id_to_stack_under: pane_id, + borderless: stacked.borderless, + }) }, None => Err("NewPanePlacement must have a placement variant"), } @@ -2309,16 +2323,25 @@ impl TryFrom<NewPanePlacement> for ProtobufNewPanePlacement { type Error = &'static str; fn try_from(placement: NewPanePlacement) -> Result<Self, &'static str> { use super::generated_api::api::action::new_pane_placement::PlacementVariant; + use super::generated_api::api::action::NoPreferenceOptions; let placement_variant = match placement { - NewPanePlacement::NoPreference => Some(PlacementVariant::NoPreference(true)), - NewPanePlacement::Tiled(direction) => { + NewPanePlacement::NoPreference { borderless } => { + Some(PlacementVariant::NoPreference(NoPreferenceOptions { + borderless, + })) + }, + NewPanePlacement::Tiled { + direction, + borderless, + } => { let direction = direction.and_then(|d| { let protobuf_direction: ProtobufResizeDirection = d.try_into().ok()?; Some(protobuf_direction as i32) }); Some(PlacementVariant::Tiled(ProtobufTiledPlacement { direction, + borderless, })) }, NewPanePlacement::Floating(coords) => { @@ -2330,17 +2353,23 @@ impl TryFrom<NewPanePlacement> for ProtobufNewPanePlacement { NewPanePlacement::InPlace { pane_id_to_replace, close_replaced_pane, + borderless, } => { let pane_id_to_replace = pane_id_to_replace.and_then(|id| id.try_into().ok()); Some(PlacementVariant::InPlace(ProtobufInPlaceConfig { pane_id_to_replace, close_replaced_pane, + borderless, })) }, - NewPanePlacement::Stacked(pane_id) => { - let pane_id = pane_id.and_then(|id| id.try_into().ok()); + NewPanePlacement::Stacked { + pane_id_to_stack_under, + borderless, + } => { + let pane_id = pane_id_to_stack_under.and_then(|id| id.try_into().ok()); Some(PlacementVariant::Stacked(ProtobufStackedPlacement { pane_id, + borderless, })) }, }; |
