diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-04-29 20:52:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-29 20:52:17 +0200 |
| commit | 27c8986939a1642f3e4afda73e9717b7bd328824 (patch) | |
| tree | e80ee57aeede2578a5ce9fa6d0ab4a350ed9d838 /zellij-utils/src/kdl | |
| parent | chore: update development version (diff) | |
| download | sl0ppij-27c8986939a1642f3e4afda73e9717b7bd328824.tar.gz sl0ppij-27c8986939a1642f3e4afda73e9717b7bd328824.tar.xz sl0ppij-27c8986939a1642f3e4afda73e9717b7bd328824.zip | |
feat: multiple Select and Bulk Pane Actions (#4169)
* initial implementation with break panes to new tab
* break pane group left/right
* group embed/eject panes
* stack pane group on resize
* close pane group
* style(fmt): rustfmt
* fix tests
* group drag and ungroup with the mouse
* fix mouse hover for multiple clients
* fix for multiple clients
* multiple select plugin initial
* use real data in plugin
* adjust functionality
* fix some ux issues
* reflect group mouse group selections in plugin
* group/ungroup panes in Zellij
* highlight frames when marked by the plugin
* refactor: render function in plugin
* some ui responsiveness
* some more responsiveness and adjust hover text
* break out functionality
* stack functionality
* break panes left/right and close multiple panes
* fix(tab): only relayout the relevant layout when non-focused pane is closed
* status bar UI
* embed and float panes
* work
* fix some ui/ux issues
* refactor: move stuff around
* some responsiveness and fix search result browsing bug
* change plugin pane title
* differentiate group from focused pane
* add keyboard shortcut
* add ui to compact bar
* make boundary colors appear properly without pane frames
* get plugins to also display their frame color
* make hover shortcuts appear on command panes
* fix: do not render search string component if it's empty
* BeforeClose Event and unhighlight panes on exit
* some UI/UX fixes
* some fixes to the catppuccin-latte theme
* remove ungroup shortcut
* make some ui components opaque
* fix more opaque elements
* fix some issues with stacking pane order
* keyboard shortcuts for grouping
* config to opt out of advanced mouse actions
* make selected + focused frame color distinct
* group marking mode
* refactor: multiple-select plugin
* adjust stacking group behavior
* adjust flashing periods
* render common modifier in group controls
* add to compact bar
* adjust key hint wording
* add key to presets and default config
* some cleanups
* some refactoring
* fix tests
* fix plugin system tests
* tests: group/ungroup/hover
* test: BeforeClose plugin event
* new plugin assets
* style(fmt): rustfmt
* remove warnings
* tests: give plugin more time to load
Diffstat (limited to 'zellij-utils/src/kdl')
9 files changed, 77 insertions, 18 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 93b111f4..e54fb2f5 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -1103,6 +1103,8 @@ impl Action { Some(node) }, Action::TogglePanePinned => Some(KdlNode::new("TogglePanePinned")), + Action::TogglePaneInGroup => Some(KdlNode::new("TogglePaneInGroup")), + Action::ToggleGroupMarking => Some(KdlNode::new("ToggleGroupMarking")), _ => None, } } @@ -1798,6 +1800,8 @@ impl TryFrom<(&KdlNode, &Options)> for Action { }) }, "TogglePanePinned" => Ok(Action::TogglePanePinned), + "TogglePaneInGroup" => Ok(Action::TogglePaneInGroup), + "ToggleGroupMarking" => Ok(Action::ToggleGroupMarking), _ => Err(ConfigError::new_kdl_error( format!("Unsupported action: {}", action_name).into(), kdl_action.span().offset(), @@ -2299,6 +2303,9 @@ impl Options { let show_release_notes = kdl_property_first_arg_as_bool_or_error!(kdl_options, "show_release_notes") .map(|(v, _)| v); + let advanced_mouse_actions = + kdl_property_first_arg_as_bool_or_error!(kdl_options, "advanced_mouse_actions") + .map(|(v, _)| v); Ok(Options { simplified_ui, theme, @@ -2330,6 +2337,7 @@ impl Options { stacked_resize, show_startup_tips, show_release_notes, + advanced_mouse_actions, }) } pub fn from_string(stringified_keybindings: &String) -> Result<Self, ConfigError> { @@ -3207,6 +3215,33 @@ impl Options { None } } + fn advanced_mouse_actions_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { + let comment_text = format!( + "{}\n{}\n{}", + " ", + "// Whether to enable mouse hover effects and pane grouping functionality", + "// default is true", + ); + + let create_node = |node_value: bool| -> KdlNode { + let mut node = KdlNode::new("advanced_mouse_actions"); + node.push(KdlValue::Bool(node_value)); + node + }; + if let Some(advanced_mouse_actions) = self.advanced_mouse_actions { + let mut node = create_node(advanced_mouse_actions); + if add_comments { + node.set_leading(format!("{}\n", comment_text)); + } + Some(node) + } else if add_comments { + let mut node = create_node(false); + node.set_leading(format!("{}\n// ", comment_text)); + Some(node) + } else { + None + } + } pub fn to_kdl(&self, add_comments: bool) -> Vec<KdlNode> { let mut nodes = vec![]; if let Some(simplified_ui_node) = self.simplified_ui_to_kdl(add_comments) { @@ -3303,6 +3338,9 @@ impl Options { if let Some(show_release_notes) = self.show_release_notes_to_kdl(add_comments) { nodes.push(show_release_notes); } + if let Some(advanced_mouse_actions) = self.advanced_mouse_actions_to_kdl(add_comments) { + nodes.push(advanced_mouse_actions); + } nodes } } @@ -4886,6 +4924,7 @@ impl PaneInfo { terminal_command, plugin_url, is_selectable, + index_in_pane_group: Default::default(), // we don't serialize this }; Ok((tab_position, pane_info)) } @@ -5033,6 +5072,7 @@ fn serialize_and_deserialize_session_info_with_data() { terminal_command: Some("foo".to_owned()), plugin_url: None, is_selectable: true, + index_in_pane_group: Default::default(), // we don't serialize this }, PaneInfo { id: 1, @@ -5057,6 +5097,7 @@ fn serialize_and_deserialize_session_info_with_data() { terminal_command: None, plugin_url: Some("i_am_a_fake_plugin".to_owned()), is_selectable: true, + index_in_pane_group: Default::default(), // we don't serialize this }, ]; let mut panes = HashMap::new(); diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string.snap index c5e53358..0a78ce71 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/kdl/mod.rs -assertion_line: 5922 expression: fake_config_stringified --- keybinds clear-defaults=true { @@ -147,8 +146,16 @@ keybinds clear-defaults=true { bind "Alt j" { MoveFocus "down"; } bind "Alt k" { MoveFocus "up"; } bind "Alt l" { MoveFocusOrTab "right"; } + bind "Alt m" { + LaunchOrFocusPlugin "zellij:multiple-select" { + floating true + move_to_focused_tab true + } + } bind "Alt n" { NewPane; } bind "Alt o" { MoveTab "right"; } + bind "Alt p" { TogglePaneInGroup; } + bind "Alt Shift p" { ToggleGroupMarking; } bind "Ctrl q" { Quit; } } shared_except "locked" "move" { @@ -256,4 +263,3 @@ plugins { } load_plugins { } - diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap index 5ace8251..81ca2f2d 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/kdl/mod.rs -assertion_line: 5934 expression: fake_config_stringified --- keybinds clear-defaults=true { @@ -147,8 +146,16 @@ keybinds clear-defaults=true { bind "Alt j" { MoveFocus "down"; } bind "Alt k" { MoveFocus "up"; } bind "Alt l" { MoveFocusOrTab "right"; } + bind "Alt m" { + LaunchOrFocusPlugin "zellij:multiple-select" { + floating true + move_to_focused_tab true + } + } bind "Alt n" { NewPane; } bind "Alt o" { MoveTab "right"; } + bind "Alt p" { TogglePaneInGroup; } + bind "Alt Shift p" { ToggleGroupMarking; } bind "Ctrl q" { Quit; } } shared_except "locked" "move" { @@ -455,4 +462,7 @@ load_plugins { // Default: true // // show_release_notes false - + +// Whether to enable mouse hover effects and pane grouping functionality +// default is true +// advanced_mouse_actions false diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap index e3c4368e..d6750cad 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/kdl/mod.rs -assertion_line: 5873 expression: fake_document.to_string() --- @@ -195,4 +194,7 @@ support_kitty_keyboard_protocol false // Default: true // // show_release_notes false - + +// Whether to enable mouse hover effects and pane grouping functionality +// default is true +// advanced_mouse_actions false diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string.snap index f1381601..f0eff7d8 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string.snap @@ -87,8 +87,8 @@ themes { frame_highlight { base 255 184 108 background 0 - emphasis_0 255 184 108 - emphasis_1 255 184 108 + emphasis_0 255 121 198 + emphasis_1 0 emphasis_2 255 184 108 emphasis_3 255 184 108 } diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_combined_definitions.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_combined_definitions.snap index ae92e207..1da7649f 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_combined_definitions.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_combined_definitions.snap @@ -87,8 +87,8 @@ themes { frame_highlight { base 208 135 112 background 0 - emphasis_0 208 135 112 - emphasis_1 208 135 112 + emphasis_0 70 + emphasis_1 0 emphasis_2 208 135 112 emphasis_3 208 135 112 } diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_eight_bit_definitions.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_eight_bit_definitions.snap index 12696b9c..73765c7f 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_eight_bit_definitions.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_eight_bit_definitions.snap @@ -87,8 +87,8 @@ themes { frame_highlight { base 254 background 0 - emphasis_0 254 - emphasis_1 254 + emphasis_0 70 + emphasis_1 0 emphasis_2 254 emphasis_3 254 } diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_hex_definitions.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_hex_definitions.snap index 81d041ac..c996a131 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_hex_definitions.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_hex_definitions.snap @@ -87,8 +87,8 @@ themes { frame_highlight { base 208 135 112 background 0 - emphasis_0 208 135 112 - emphasis_1 208 135 112 + emphasis_0 180 142 173 + emphasis_1 0 emphasis_2 208 135 112 emphasis_3 208 135 112 } diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_multiple_theme_definitions.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_multiple_theme_definitions.snap index abae11d8..cb289642 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_multiple_theme_definitions.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__themes_to_string_with_multiple_theme_definitions.snap @@ -87,8 +87,8 @@ themes { frame_highlight { base 255 184 108 background 0 - emphasis_0 255 184 108 - emphasis_1 255 184 108 + emphasis_0 255 121 198 + emphasis_1 0 emphasis_2 255 184 108 emphasis_3 255 184 108 } @@ -205,8 +205,8 @@ themes { frame_highlight { base 208 135 112 background 0 - emphasis_0 208 135 112 - emphasis_1 208 135 112 + emphasis_0 180 142 173 + emphasis_1 0 emphasis_2 208 135 112 emphasis_3 208 135 112 } |
