multi-line copy/paste, more copy/paste

fix C and D in nimbus romono
This commit is contained in:
stjet
2025-04-26 05:17:06 +00:00
parent 7c6a7d6b6d
commit 724ffbd494
12 changed files with 78 additions and 19 deletions

View File

@@ -14,7 +14,7 @@ use mp4ameta;
use metaflac;
use ming_wm_lib::window_manager_types::{ DrawInstructions, WindowLike, WindowLikeType };
use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse };
use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse, WindowManagerRequest, ShortcutType };
use ming_wm_lib::framebuffer_types::Dimensions;
use ming_wm_lib::themes::ThemeInfo;
use ming_wm_lib::utils::{ concat_paths, get_all_files, path_autocomplete, format_seconds, Substring };
@@ -79,7 +79,6 @@ pub struct AudioPlayer {
impl WindowLike for AudioPlayer {
fn handle_message(&mut self, message: WindowMessage) -> WindowMessageResponse {
//
match message {
WindowMessage::Init(dimensions) => {
self.dimensions = dimensions;
@@ -116,6 +115,27 @@ impl WindowLike for AudioPlayer {
}
WindowMessageResponse::JustRedraw
},
WindowMessage::Shortcut(shortcut) => {
match shortcut {
ShortcutType::ClipboardPaste(paste_string) => {
self.command += &paste_string.replace("\n", "");
WindowMessageResponse::JustRedraw
},
ShortcutType::ClipboardCopy => {
let internal_locked = self.internal.lock().unwrap();
let sink_len = internal_locked.sink.len();
if sink_len > 0 {
let queue = &internal_locked.queue;
let current = &queue[queue.len() - sink_len];
let current_name = current.0.file_name().unwrap().to_string_lossy().into_owned();
WindowMessageResponse::Request(WindowManagerRequest::ClipboardCopy(current_name))
} else {
WindowMessageResponse::DoNothing
}
},
_ => WindowMessageResponse::DoNothing,
}
},
_ => {
WindowMessageResponse::DoNothing
},