diff options
author | qkzk <qu3nt1n@gmail.com> | 2022-12-02 21:46:00 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2022-12-02 21:46:00 +0100 |
commit | 79a3570b6f14b790c584e54f69f4f4e20f28226b (patch) | |
tree | 2f320cfe59b3af139c2e2482ded3f7a13cb4722b | |
parent | 549488c158a2c52d5ce0323b5a2c10e02b899593 (diff) |
no icon in notification. IDK how to install them...notif_copy
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | media/folder-teal-activities.svg | 13 | ||||
-rw-r--r-- | src/copy_move.rs | 33 |
3 files changed, 19 insertions, 28 deletions
@@ -1,6 +1,7 @@ [package] name = "fm" version = "0.1.0" +authors = ["Quentin Konieczko <qu3nt1n@gmail.com>"] edition = "2021" [profile.release] diff --git a/media/folder-teal-activities.svg b/media/folder-teal-activities.svg deleted file mode 100644 index fca2b9b..0000000 --- a/media/folder-teal-activities.svg +++ /dev/null @@ -1,13 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" version="1"> - <rect style="opacity:0.2" width="56" height="36" x="4" y="22" rx="2.8" ry="2.8"/> - <path style="fill:#12806a" d="M 6.8,7 C 5.25,7 4,8.25 4,9.8 V 46.2 C 4,47.75 5.25,49 6.8,49 H 57.2 C 58.75,49 60,47.75 60,46.2 V 15.8 C 60,14.25 58.75,13 57.2,13 H 30 V 9.8 C 30,8.245 28.75,7 27.2,7 Z"/> - <rect style="opacity:0.2" width="56" height="36" x="4" y="20" rx="2.8" ry="2.8"/> - <rect style="fill:#e4e4e4" width="48" height="22" x="8" y="16" rx="2.8" ry="2.8"/> - <rect style="fill:#16a085" width="56" height="36" x="4" y="21" rx="2.8" ry="2.8"/> - <path style="opacity:0.1;fill:#ffffff" d="M 6.8,7 C 5.25,7 4,8.25 4,9.8 V 10.8 C 4,9.25 5.25,8 6.8,8 H 27.2 C 28.75,8 30,9.2458 30,10.8 V 9.8 C 30,8.2458 28.75,7 27.2,7 Z M 30,13 V 14 H 57.2 C 58.745,14 60,15.25 60,16.8 V 15.8 C 60,14.25 58.75,13 57.2,13 Z"/> - <g> - <circle style="fill:#08382e" cx="24" cy="39" r="3"/> - <circle style="fill:#08382e" cx="32" cy="39" r="3"/> - <circle style="fill:#08382e" cx="40" cy="39" r="3"/> - </g> -</svg> diff --git a/src/copy_move.rs b/src/copy_move.rs index 6aa5190..a4ecc05 100644 --- a/src/copy_move.rs +++ b/src/copy_move.rs @@ -71,6 +71,13 @@ impl CopyMove { CopyMove::Move => "move", } } + + fn preterit(&self) -> &str { + match *self { + CopyMove::Copy => "copied", + CopyMove::Move => "moved", + } + } } pub fn copy_move( @@ -86,30 +93,26 @@ pub fn copy_move( handle_progress_display(&in_mem, &pb, &term, process_info) }; let _ = thread::spawn(move || { - let transfered_bytes = match copy_or_move { - CopyMove::Copy => { - fs_extra::copy_items_with_progress(&sources, &dest, &options, handle_progress) - .unwrap_or_default() - } - CopyMove::Move => { - fs_extra::move_items_with_progress(&sources, &dest, &options, handle_progress) - .unwrap_or_default() - } + let copier_mover = match copy_or_move { + CopyMove::Copy => fs_extra::copy_items_with_progress, + CopyMove::Move => fs_extra::move_items_with_progress, }; + let transfered_bytes = + copier_mover(&sources, &dest, &options, handle_progress).unwrap_or_default(); let _ = c_term.send_event(Event::User(())); let _ = notify( &format!("fm: {} finished", copy_or_move.kind()), - &format!("{}B transfered", human_size(transfered_bytes)), + &format!( + "{}B {}", + human_size(transfered_bytes), + copy_or_move.preterit() + ), ); }); Ok(()) } pub fn notify(summary: &str, body: &str) -> FmResult<()> { - Notification::new() - .summary(summary) - .body(body) - .icon("/home/quentin/gclem/dev/rust/fm/media/folder-teal-activities.svg") - .show()?; + Notification::new().summary(summary).body(body).show()?; Ok(()) } |