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 15202b9 commit 92d0ce6
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 @@ -49,7 +49,7 @@ jsonwebtoken = "9.2.0"
chrono = "0.4"

# 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 @@ -274,7 +274,10 @@ 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 @@ -284,7 +287,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 92d0ce6

Please # to comment.