Skip to content

Commit

Permalink
fix copy in macos arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
deepu105 committed Jan 18, 2024
1 parent 003f05c commit 09e2f08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ glob-match = "0.2.1"
rand = "0.8"

# XCB is a PITA to compile for ARM so disabling the copy feature on ARM for now
[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(any(target_arch = "x86_64", all(target_os = "macos", target_arch = "aarch64")))'.dependencies]
clipboard = "0.5"

[dev-dependencies.cargo-husky]
Expand Down
10 changes: 8 additions & 2 deletions src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,10 @@ async fn handle_block_scroll(app: &mut App, up: bool, is_mouse: bool, page: bool
}
}

#[cfg(target_arch = "x86_64")]
#[cfg(any(
target_arch = "x86_64",
all(target_os = "macos", target_arch = "aarch64")
))]
fn copy_to_clipboard(content: String) {
use clipboard::{ClipboardContext, ClipboardProvider};

Expand All @@ -748,7 +751,10 @@ fn copy_to_clipboard(content: String) {
.expect("Unable to set content to clipboard");
}

#[cfg(any(target_arch = "aarch64", target_arch = "arm"))]
#[cfg(not(any(
target_arch = "x86_64",
all(target_os = "macos", target_arch = "aarch64")
)))]
fn copy_to_clipboard(_content: String) {
// do nothing as its a PITA to compile for ARM with XCB and this feature is not that important
}
Expand Down

0 comments on commit 09e2f08

Please sign in to comment.