|
|
@ -56,16 +56,29 @@ macro_rules! command_provider {
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
|
|
|
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
|
|
|
// TODO: support for user-defined provider, probably when we have plugin support by setting a
|
|
|
|
Box::new(provider::WindowsProvider::default())
|
|
|
|
// variable?
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
|
|
|
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
|
|
|
if exists("pbcopy") && exists("pbpaste") {
|
|
|
|
if exists("pbcopy") && exists("pbpaste") {
|
|
|
|
command_provider! {
|
|
|
|
command_provider! {
|
|
|
|
paste => "pbpaste";
|
|
|
|
paste => "pbpaste";
|
|
|
|
copy => "pbcopy";
|
|
|
|
copy => "pbcopy";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if env_var_is_set("WAYLAND_DISPLAY") && exists("wl-copy") && exists("wl-paste") {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Box::new(provider::NopProvider::new())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(any(windows, target_os = "macos")))]
|
|
|
|
|
|
|
|
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
|
|
|
|
|
|
|
// TODO: support for user-defined provider, probably when we have plugin support by setting a
|
|
|
|
|
|
|
|
// variable?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if env_var_is_set("WAYLAND_DISPLAY") && exists("wl-copy") && exists("wl-paste") {
|
|
|
|
command_provider! {
|
|
|
|
command_provider! {
|
|
|
|
paste => "wl-paste", "--no-newline";
|
|
|
|
paste => "wl-paste", "--no-newline";
|
|
|
|
copy => "wl-copy", "--type", "text/plain";
|
|
|
|
copy => "wl-copy", "--type", "text/plain";
|
|
|
@ -88,22 +101,6 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
|
|
|
primary_paste => "xsel", "-o";
|
|
|
|
primary_paste => "xsel", "-o";
|
|
|
|
primary_copy => "xsel", "-i";
|
|
|
|
primary_copy => "xsel", "-i";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if exists("lemonade") {
|
|
|
|
|
|
|
|
command_provider! {
|
|
|
|
|
|
|
|
paste => "lemonade", "paste";
|
|
|
|
|
|
|
|
copy => "lemonade", "copy";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if exists("doitclient") {
|
|
|
|
|
|
|
|
command_provider! {
|
|
|
|
|
|
|
|
paste => "doitclient", "wclip", "-r";
|
|
|
|
|
|
|
|
copy => "doitclient", "wclip";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if exists("win32yank.exe") {
|
|
|
|
|
|
|
|
// FIXME: does it work within WSL?
|
|
|
|
|
|
|
|
command_provider! {
|
|
|
|
|
|
|
|
paste => "win32yank.exe", "-o", "--lf";
|
|
|
|
|
|
|
|
copy => "win32yank.exe", "-i", "--crlf";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if exists("termux-clipboard-set") && exists("termux-clipboard-get") {
|
|
|
|
} else if exists("termux-clipboard-set") && exists("termux-clipboard-get") {
|
|
|
|
command_provider! {
|
|
|
|
command_provider! {
|
|
|
|
paste => "termux-clipboard-get";
|
|
|
|
paste => "termux-clipboard-get";
|
|
|
@ -115,11 +112,7 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
|
|
|
copy => "tmux", "load-buffer", "-";
|
|
|
|
copy => "tmux", "load-buffer", "-";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
Box::new(provider::NopProvider::new())
|
|
|
|
return Box::new(provider::WindowsProvider::default());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(target_os = "windows"))]
|
|
|
|
|
|
|
|
return Box::new(provider::NopProvider::new());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|