diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index 454bc0d3d..438206966 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -104,6 +104,7 @@ message PeerInfo { // Use JSON's key-value format which is friendly for peer to handle. // NOTE: Only support one-level dictionaries (for peer to update), and the key is of type string. string platform_additions = 12; + bool has_file_clipboard = 13; } message LoginResponse { diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index 36cf38715..2d46097ed 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -1706,7 +1706,10 @@ impl Remote { fn check_clipboard_file_context(&self) { #[cfg(any( target_os = "windows", - all(feature = "unix-file-copy-paste", target_os = "linux") + all( + feature = "unix-file-copy-paste", + any(target_os = "linux", target_os = "macos") + ) ))] { let enabled = *self.handler.server_file_transfer_enabled.read().unwrap() diff --git a/src/server/connection.rs b/src/server/connection.rs index d74f4815e..8927eaf11 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -1019,6 +1019,13 @@ impl Connection { let mut pi = PeerInfo { username: username.clone(), version: VERSION.to_owned(), + has_file_clipboard: cfg!(any( + target_os = "windows", + all( + feature = "unix-file-copy-paste", + any(target_os = "linux", target_os = "macos") + ) + )), ..Default::default() }; diff --git a/src/server/display_service.rs b/src/server/display_service.rs index 30225e491..22103f790 100644 --- a/src/server/display_service.rs +++ b/src/server/display_service.rs @@ -153,6 +153,13 @@ pub fn new() -> GenericService { fn displays_to_msg(displays: Vec) -> Message { let mut pi = PeerInfo { + has_file_clipboard: cfg!(any( + target_os = "windows", + all( + feature = "unix-file-copy-paste", + any(target_os = "linux", target_os = "macos") + ) + )), ..Default::default() }; pi.displays = displays.clone(); diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs index 5308305d1..83c43d24b 100644 --- a/src/ui_cm_interface.rs +++ b/src/ui_cm_interface.rs @@ -577,7 +577,10 @@ pub async fn start_ipc(cm: ConnectionManager) { #[cfg(any( target_os = "windows", - all(target_os = "linux", feature = "unix-file-copy-paste"), + all( + any(target_os = "linux", target_os = "macos"), + feature = "unix-file-copy-paste" + ), ))] ContextSend::enable(Config::get_option("enable-file-transfer").is_empty()); diff --git a/src/ui_interface.rs b/src/ui_interface.rs index 39dd92158..d60220634 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -1030,8 +1030,12 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver(handler: Session, round: u32) { // It is ok to call this function multiple times. #[cfg(any( target_os = "windows", - all(target_os = "linux", feature = "unix-file-copy-paste") + all( + any(target_os = "linux", target_os = "macos"), + feature = "unix-file-copy-paste" + ) ))] if !handler.is_file_transfer() && !handler.is_port_forward() { clipboard::ContextSend::enable(true);