mirror of
https://github.com/timvisee/ffsend.git
synced 2025-10-06 02:29:57 +02:00
Add clipboard suppor:t, make URL open feature toggleable
This commit is contained in:
parent
a4aa1b93e5
commit
523cbc3a19
5 changed files with 161 additions and 5 deletions
|
@ -1,8 +1,11 @@
|
|||
extern crate clipboard;
|
||||
extern crate open;
|
||||
|
||||
use std::error::Error;
|
||||
use std::io::Error as IoError;
|
||||
use std::process::{exit, ExitStatus};
|
||||
|
||||
use self::clipboard::{ClipboardContext, ClipboardProvider};
|
||||
use ffsend_api::url::Url;
|
||||
|
||||
/// Quit the application with an error code,
|
||||
|
@ -26,3 +29,9 @@ pub fn open_url(url: Url) -> Result<ExitStatus, IoError> {
|
|||
pub fn open_path(path: &str) -> Result<ExitStatus, IoError> {
|
||||
open::that(path)
|
||||
}
|
||||
|
||||
/// Set the clipboard of the user to the given `content` string.
|
||||
pub fn set_clipboard(content: String) -> Result<(), Box<Error>> {
|
||||
let mut context: ClipboardContext = ClipboardProvider::new()?;
|
||||
context.set_contents(content)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue