Detect tmux clipboard provider on macOS (#8182)

main
Jonathan LEI 1 year ago committed by GitHub
parent 48b7520bca
commit 8778083b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -73,9 +73,14 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
use crate::env::binary_exists; use crate::env::{binary_exists, env_var_is_set};
if binary_exists("pbcopy") && binary_exists("pbpaste") { if env_var_is_set("TMUX") && binary_exists("tmux") {
command_provider! {
paste => "tmux", "save-buffer", "-";
copy => "tmux", "load-buffer", "-w", "-";
}
} else if binary_exists("pbcopy") && binary_exists("pbpaste") {
command_provider! { command_provider! {
paste => "pbpaste"; paste => "pbpaste";
copy => "pbcopy"; copy => "pbcopy";

Loading…
Cancel
Save