aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-06-07 12:43:35 +0200
committerGitHub <noreply@github.com>2023-06-07 12:43:35 +0200
commitc11d75f9157873fc99fe0d40933de8ec5fbb4f6b (patch)
treefc55dc7f9132395585613dd9cce94c98c8c76600 /zellij-utils/src/input
parentdocs(changelog): fix cwd of newtab action (diff)
downloadsl0ppij-c11d75f9157873fc99fe0d40933de8ec5fbb4f6b.tar.gz
sl0ppij-c11d75f9157873fc99fe0d40933de8ec5fbb4f6b.tar.xz
sl0ppij-c11d75f9157873fc99fe0d40933de8ec5fbb4f6b.zip
feat(wasm-plugin-system): major overhaul and some goodies (#2510)
* strider resiliency * worker channel prototype * finalized ui * show hide plugin * fs events to plugins * tests for events and new screen instructions * various refactoringz * report plugin errors instead of crashing zellij * fix plugin loading with workers * refactor: move watch filesystem * some fixes and refactoring * refactor(panes): combine pane insertion logic * refactor(screen): launch or focus * refactor(pty): consolidate default shell fetching * refactor: various cleanups * initial refactoring * more initial refactoring * refactor(strider): search * style(fmt): rustfmt * style(pty): cleanup * style(clippy): ok clippy * style(fmt): rustfmt
Diffstat (limited to 'zellij-utils/src/input')
-rw-r--r--zellij-utils/src/input/actions.rs12
-rw-r--r--zellij-utils/src/input/command.rs13
2 files changed, 24 insertions, 1 deletions
diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs
index c288b8d2..36d59dde 100644
--- a/zellij-utils/src/input/actions.rs
+++ b/zellij-utils/src/input/actions.rs
@@ -2,7 +2,7 @@
use super::command::RunCommandAction;
use super::layout::{
- FloatingPaneLayout, Layout, RunPluginLocation, SwapFloatingLayout, SwapTiledLayout,
+ FloatingPaneLayout, Layout, RunPlugin, RunPluginLocation, SwapFloatingLayout, SwapTiledLayout,
TiledPaneLayout,
};
use crate::cli::CliAction;
@@ -205,6 +205,7 @@ pub enum Action {
LeftClick(Position),
RightClick(Position),
MiddleClick(Position),
+ LaunchOrFocusPlugin(RunPlugin, bool), // bool => should float
LeftMouseRelease(Position),
RightMouseRelease(Position),
MiddleMouseRelease(Position),
@@ -474,6 +475,15 @@ impl Action {
CliAction::NextSwapLayout => Ok(vec![Action::NextSwapLayout]),
CliAction::QueryTabNames => Ok(vec![Action::QueryTabNames]),
CliAction::StartOrReloadPlugin { url } => Ok(vec![Action::StartOrReloadPlugin(url)]),
+ CliAction::LaunchOrFocusPlugin { url, floating } => {
+ let run_plugin_location = RunPluginLocation::parse(url.as_str())
+ .map_err(|e| format!("Failed to parse plugin location: {}", e))?;
+ let run_plugin = RunPlugin {
+ location: run_plugin_location,
+ _allow_exec_host_cmd: false,
+ };
+ Ok(vec![Action::LaunchOrFocusPlugin(run_plugin, floating)])
+ },
}
}
}
diff --git a/zellij-utils/src/input/command.rs b/zellij-utils/src/input/command.rs
index 3d2a87ab..3212d26e 100644
--- a/zellij-utils/src/input/command.rs
+++ b/zellij-utils/src/input/command.rs
@@ -68,3 +68,16 @@ impl From<RunCommandAction> for RunCommand {
}
}
}
+
+impl RunCommand {
+ pub fn new(command: PathBuf) -> Self {
+ RunCommand {
+ command,
+ ..Default::default()
+ }
+ }
+ pub fn with_cwd(mut self, cwd: PathBuf) -> Self {
+ self.cwd = Some(cwd);
+ self
+ }
+}