diff options
author | Thomas Linford <tlinford@users.noreply.github.com> | 2022-02-02 15:22:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 15:22:34 +0100 |
commit | 18709acde974736492972b2892f69cea5f55716f (patch) | |
tree | f7990efbe51196f141a94c17b042c91389fb283e /zellij-utils/src | |
parent | 2799eb91607a56b99a9417249e6735b11deebd51 (diff) |
feat(copy): allow osc52 copy destination configuration (#1022)
add copy_cliboard option to allow configuring copy destination to primary selection instead of default clipboard
Diffstat (limited to 'zellij-utils/src')
-rw-r--r-- | zellij-utils/src/input/options.rs | 24 | ||||
-rw-r--r-- | zellij-utils/src/lib.rs | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/zellij-utils/src/input/options.rs b/zellij-utils/src/input/options.rs index 41f241f69..34b4dc88a 100644 --- a/zellij-utils/src/input/options.rs +++ b/zellij-utils/src/input/options.rs @@ -79,6 +79,25 @@ pub struct Options { #[clap(long)] #[serde(default)] pub copy_command: Option<String>, + + /// OSC52 destination clipboard + #[clap(long, arg_enum, ignore_case = true, conflicts_with = "copy-command")] + #[serde(default)] + pub copy_clipboard: Option<Clipboard>, +} + +#[derive(ArgEnum, Deserialize, Serialize, Debug, Clone, PartialEq)] +pub enum Clipboard { + #[serde(alias = "system")] + System, + #[serde(alias = "primary")] + Primary, +} + +impl Default for Clipboard { + fn default() -> Self { + Self::System + } } impl Options { @@ -105,6 +124,7 @@ impl Options { let on_force_close = other.on_force_close.or(self.on_force_close); let scroll_buffer_size = other.scroll_buffer_size.or(self.scroll_buffer_size); let copy_command = other.copy_command.or_else(|| self.copy_command.clone()); + let copy_clipboard = other.copy_clipboard.or_else(|| self.copy_clipboard.clone()); Options { simplified_ui, @@ -118,6 +138,7 @@ impl Options { on_force_close, scroll_buffer_size, copy_command, + copy_clipboard, } } @@ -148,6 +169,7 @@ impl Options { let on_force_close = other.on_force_close.or(self.on_force_close); let scroll_buffer_size = other.scroll_buffer_size.or(self.scroll_buffer_size); let copy_command = other.copy_command.or_else(|| self.copy_command.clone()); + let copy_clipboard = other.copy_clipboard.or_else(|| self.copy_clipboard.clone()); Options { simplified_ui, @@ -161,6 +183,7 @@ impl Options { on_force_close, scroll_buffer_size, copy_command, + copy_clipboard, } } @@ -210,6 +233,7 @@ impl From<CliOptions> for Options { on_force_close: opts.on_force_close, scroll_buffer_size: opts.scroll_buffer_size, copy_command: opts.copy_command, + copy_clipboard: opts.copy_clipboard, } } } diff --git a/zellij-utils/src/lib.rs b/zellij-utils/src/lib.rs index 7115c1b46..7eb9825ab 100644 --- a/zellij-utils/src/lib.rs +++ b/zellij-utils/src/lib.rs @@ -11,6 +11,7 @@ pub mod position; pub mod setup; pub mod shared; +pub use anyhow; pub use async_std; pub use clap; pub use interprocess; |