add option to copy path when pressing down shift
This commit is contained in:
parent
f1a8e4ea19
commit
4e77e398f2
4 changed files with 22 additions and 2 deletions
10
src/app.rs
10
src/app.rs
|
|
@ -146,6 +146,7 @@ pub enum Action {
|
|||
AddToSidebar,
|
||||
Compress,
|
||||
Copy,
|
||||
CopyPath,
|
||||
CopyTo,
|
||||
Cut,
|
||||
CosmicSettingsDesktop,
|
||||
|
|
@ -215,6 +216,7 @@ impl Action {
|
|||
Self::AddToSidebar => Message::AddToSidebar(entity_opt),
|
||||
Self::Compress => Message::Compress(entity_opt),
|
||||
Self::Copy => Message::Copy(entity_opt),
|
||||
Self::CopyPath => Message::CopyPath(entity_opt),
|
||||
Self::CopyTo => Message::CopyTo(entity_opt),
|
||||
Self::Cut => Message::Cut(entity_opt),
|
||||
Self::CosmicSettingsDesktop => Message::CosmicSettings("desktop"),
|
||||
|
|
@ -340,6 +342,7 @@ pub enum Message {
|
|||
Compress(Option<Entity>),
|
||||
Config(Config),
|
||||
Copy(Option<Entity>),
|
||||
CopyPath(Option<Entity>),
|
||||
CopyTo(Option<Entity>),
|
||||
CopyToResult(DialogResult),
|
||||
CosmicSettings(&'static str),
|
||||
|
|
@ -2744,6 +2747,13 @@ impl Application for App {
|
|||
let contents = ClipboardCopy::new(ClipboardKind::Copy, paths);
|
||||
return clipboard::write_data(contents);
|
||||
}
|
||||
Message::CopyPath(entity_opt) => {
|
||||
let paths = self.selected_paths(entity_opt);
|
||||
let path_strings: Vec<String> =
|
||||
paths.into_iter().map(|p| p.display().to_string()).collect();
|
||||
let text = path_strings.join("\n");
|
||||
return clipboard::write(text);
|
||||
}
|
||||
Message::CopyTo(entity_opt) => {
|
||||
let selected_paths: Box<[_]> = self.selected_paths(entity_opt).collect();
|
||||
return self.copy_to(&selected_paths);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue