Skip to content

Commit

Permalink
🐛 Fixed cross compiling error
Browse files Browse the repository at this point in the history
  • Loading branch information
nwrenger committed Mar 30, 2024
1 parent 1023ea1 commit 6edf4cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ codegen-units = 1
strip = true

[dependencies]
clippers = "0.1.2"
arboard = "3.3.2"
cursive = { version = "0.20.0", default-features = false, features = [
"crossterm-backend",
] }
Expand Down
18 changes: 6 additions & 12 deletions src/clipboard.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
use clippers::{Clipboard, ClipperData};
use arboard::Clipboard;

use crate::error::{Error, Result};
use crate::error::Result;

/// Gets the clipboard content (text)
pub fn get_content() -> Result<String> {
let mut clipboard = Clipboard::get();
let mut clipboard = Clipboard::new()?;

if let Some(ClipperData::Text(text)) = clipboard.read() {
Ok(text.to_string())
} else {
Err(Error::Clipboard(
"Pasted in Something which isn't Text, f.e. a picture".to_string(),
))
}
Ok(clipboard.get_text()?)
}

/// Sets the clipboard content
pub fn set_content(content: String) -> Result<()> {
let mut clipboard = Clipboard::get();
let mut clipboard = Clipboard::new()?;

Ok(clipboard.write_text(content)?)
Ok(clipboard.set_text(content)?)
}
6 changes: 3 additions & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ impl From<std::convert::Infallible> for Error {
}
}

impl From<clippers::Error> for Error {
fn from(e: clippers::Error) -> Self {
error!("clippers::Error: {e}");
impl From<arboard::Error> for Error {
fn from(e: arboard::Error) -> Self {
error!("arboard::Error: {e}");
Self::Clipboard(e.to_string())
}
}
Expand Down

0 comments on commit 6edf4cc

Please sign in to comment.