diff --git a/src/gui/draw.rs b/src/gui/draw.rs index 9cd6a65..11ed8c9 100644 --- a/src/gui/draw.rs +++ b/src/gui/draw.rs @@ -10,7 +10,7 @@ use pwsp::types::socket::Request; use pwsp::types::{audio_player::TrackInfo, gui::AppState}; use pwsp::utils::gui::{format_time_pair, make_request_async}; use std::{ - path::{Path, PathBuf}, + path::Path, time::Instant, }; @@ -440,7 +440,7 @@ impl SoundpadGui { ) .default_open(true) .show(ui, |ui| { - if let Some(act) = Self::draw_track_control(ui, &mut self.app_state, &track) { + if let Some(act) = Self::draw_track_control(ui, &mut self.app_state, track) { action = Some(act); } }); @@ -866,11 +866,11 @@ impl SoundpadGui { }); } - fn get_hotkey_badge(&self, path: &PathBuf) -> Option { + fn get_hotkey_badge(&self, path: &Path) -> Option { for slot in &self.app_state.hotkey_config.slots { if slot.action.name == "play" && let Some(file_path_str) = slot.action.args.get("file_path") - && Path::new(file_path_str) == path.as_path() + && Path::new(file_path_str) == path { if let Some(chord) = &slot.key_chord { return Some(format!("[{}]", chord)); diff --git a/src/gui/mod.rs b/src/gui/mod.rs index da2b228..3dbcc6f 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -21,7 +21,7 @@ use pwsp::{ use rfd::FileDialog; use std::{ error::Error, - path::PathBuf, + path::{Path, PathBuf}, sync::{Arc, Mutex}, }; @@ -120,7 +120,7 @@ impl SoundpadGui { } } - pub fn play_file(&mut self, path: &PathBuf, concurrent: bool) { + pub fn play_file(&mut self, path: &Path, concurrent: bool) { make_request_async(Request::play(&path.to_string_lossy(), concurrent)); } diff --git a/src/utils/pipewire.rs b/src/utils/pipewire.rs index 85a59ab..cb15a07 100644 --- a/src/utils/pipewire.rs +++ b/src/utils/pipewire.rs @@ -229,8 +229,8 @@ pub async fn get_all_devices() -> Result<(Vec, Vec), B let mut output_devices: Vec = output_devices.values().cloned().collect(); - input_devices.sort_by(|a, b| a.id.cmp(&b.id)); - output_devices.sort_by(|a, b| a.id.cmp(&b.id)); + input_devices.sort_by_key(|a| a.id); + output_devices.sort_by_key(|a| a.id); return Ok((input_devices, output_devices)); }