mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
feat: you can now open dirs/files in system's file manager using context menus
This commit is contained in:
+30
-4
@@ -5,12 +5,10 @@ use egui::{
|
||||
};
|
||||
use egui_dnd::dnd;
|
||||
use egui_material_icons::icons;
|
||||
use pwsp::types::audio_player::TrackInfo;
|
||||
use pwsp::types::{audio_player::TrackInfo, gui::AppState};
|
||||
use pwsp::utils::gui::format_time_pair;
|
||||
use std::{error::Error, time::Instant};
|
||||
|
||||
use pwsp::types::gui::AppState;
|
||||
|
||||
enum TrackAction {
|
||||
Pause(u32),
|
||||
Resume(u32),
|
||||
@@ -343,12 +341,25 @@ impl SoundpadGui {
|
||||
// Context menu
|
||||
dir_button_response.context_menu(|ui| {
|
||||
if ui
|
||||
.button(format!("{} {}", icons::ICON_OPEN_IN_NEW, "Open"))
|
||||
.button(format!("{} {}", icons::ICON_OPEN_IN_NEW, "Show"))
|
||||
.clicked()
|
||||
{
|
||||
self.open_dir(&path);
|
||||
}
|
||||
|
||||
if ui
|
||||
.button(format!(
|
||||
"{} {}",
|
||||
icons::ICON_OPEN_IN_BROWSER,
|
||||
"Open in File Manager"
|
||||
))
|
||||
.clicked()
|
||||
{
|
||||
if let Err(e) = opener::open(&path) {
|
||||
eprintln!("Failed to open file manager: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
ui.separator();
|
||||
|
||||
if ui
|
||||
@@ -465,6 +476,21 @@ impl SoundpadGui {
|
||||
self.play_file(&entry_path, true);
|
||||
self.app_state.selected_file = Some(entry_path.clone());
|
||||
}
|
||||
|
||||
ui.separator();
|
||||
|
||||
if ui
|
||||
.button(format!(
|
||||
"{} {}",
|
||||
icons::ICON_OPEN_IN_BROWSER,
|
||||
"Show in File Manager"
|
||||
))
|
||||
.clicked()
|
||||
{
|
||||
if let Err(e) = opener::reveal(&entry_path) {
|
||||
eprintln!("Failed to open file manager: {}", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user