Skip to content

Commit

Permalink
feat: Add Wayland clipboard support (lwthiker#30)
Browse files Browse the repository at this point in the history
* Add Wayland clipboard support, update copypasta-ext

* Bump MSRV to 1.47.0
  • Loading branch information
timvisee committed Jul 25, 2021
1 parent 3c460c0 commit 9434cd4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ crossterm = "0.20.0"
anyhow = "1.0.42"
chrono = "0.4.19"
unicode-width = "0.1.8"
copypasta-ext = "0.3.4"
copypasta-ext = "0.3.7"
colorsys = "0.6.3"
rust-embed = "5.9.0"
shellexpand = "2.1.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ It aims to ease the key management operations such as listing/exporting/signing

## Requirements

- [Rust](https://www.rust-lang.org/): `>=1.46.0`
- [Rust](https://www.rust-lang.org/): `>=1.47.0`
- Core dependencies: `gnupg`, `gpgme>=1.7.0`, `libgpg-error`
- Other dependencies: `libxcb`

Expand Down
12 changes: 6 additions & 6 deletions src/app/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::widget::style::Color as WidgetColor;
use crate::widget::table::{StatefulTable, TableSize, TableState};
use anyhow::{anyhow, Error as AnyhowError, Result};
use colorsys::Rgb;
use copypasta_ext::display::DisplayServer as ClipboardDisplayServer;
use copypasta_ext::prelude::ClipboardProvider;
use copypasta_ext::x11_fork::ClipboardContext;
use std::collections::HashMap;
use std::path::Path;
use std::process::Command as OsCommand;
Expand Down Expand Up @@ -58,7 +58,7 @@ pub struct App<'a> {
/// Bottom margin value of the keys table.
pub keys_table_margin: u16,
/// Clipboard context.
pub clipboard: Option<ClipboardContext>,
pub clipboard: Option<Box<dyn ClipboardProvider>>,
/// GPGME context.
pub gpgme: &'a mut GpgContext,
}
Expand Down Expand Up @@ -95,12 +95,12 @@ impl<'a> App<'a> {
keys_table_states: HashMap::new(),
keys_table_detail: KeyDetail::Minimum,
keys_table_margin: 1,
clipboard: match ClipboardContext::new() {
Ok(clipboard) => Some(clipboard),
Err(e) => {
eprintln!("failed to initialize clipboard: {:?}", e);
clipboard: match ClipboardDisplayServer::select().try_context() {
None => {
eprintln!("failed to initialize clipboard, no suitable clipboard provider found");
None
}
clipboard => clipboard,
},
gpgme,
})
Expand Down

0 comments on commit 9434cd4

Please sign in to comment.