Skip to content

Commit

Permalink
fix(keybinds): add 'floating' and 'name' to the Run command keybinding (
Browse files Browse the repository at this point in the history
#2726)

* fix(keybinds): add 'floating' and 'name' to the Run command keybinding

* style(fmt): rustfmt
  • Loading branch information
imsnif authored Aug 25, 2023
1 parent e34f7e7 commit a537e09
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion zellij-utils/src/kdl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
let cwd = command_metadata
.and_then(|c_m| kdl_child_string_value_for_entry(c_m, "cwd"))
.map(|cwd_string| PathBuf::from(cwd_string));
let name = command_metadata
.and_then(|c_m| kdl_child_string_value_for_entry(c_m, "name"))
.map(|name_string| name_string.to_string());
let direction = command_metadata
.and_then(|c_m| kdl_child_string_value_for_entry(c_m, "direction"))
.and_then(|direction_string| Direction::from_str(direction_string).ok());
Expand All @@ -880,6 +883,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
let hold_on_start = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "start_suspended"))
.unwrap_or(false);
let floating = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "floating"))
.unwrap_or(false);
let run_command_action = RunCommandAction {
command: PathBuf::from(command),
args,
Expand All @@ -888,7 +894,15 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
hold_on_close,
hold_on_start,
};
Ok(Action::Run(run_command_action))
if floating {
Ok(Action::NewFloatingPane(Some(run_command_action), name))
} else {
Ok(Action::NewTiledPane(
direction,
Some(run_command_action),
name,
))
}
},
"LaunchOrFocusPlugin" => {
let arguments = action_arguments.iter().copied();
Expand Down

0 comments on commit a537e09

Please sign in to comment.