feat(shortcuts): show all hotkey bindings

- Removed command filtering logic from the shortcuts UI.
- All hotkey bindings are now shown regardless of command.
- Improved UI with hint text for the filter input.
This commit is contained in:
Martin Hjulstad Bednar
2025-07-16 23:49:24 +02:00
committed by LGUG2Z
parent 6416c0b6eb
commit 7839980ddf
+2 -10
View File
@@ -1,6 +1,5 @@
use eframe::egui::ViewportBuilder; use eframe::egui::ViewportBuilder;
use std::path::PathBuf; use std::path::PathBuf;
use whkd_core::HotkeyBinding;
use whkd_core::Whkdrc; use whkd_core::Whkdrc;
#[derive(Default)] #[derive(Default)]
@@ -58,16 +57,14 @@ impl eframe::App for Quicklook {
ui.label("Filter"); ui.label("Filter");
ui.add( ui.add(
eframe::egui::text_edit::TextEdit::singleline(&mut self.filter) eframe::egui::text_edit::TextEdit::singleline(&mut self.filter)
.hint_text("Filter by command...")
.background_color(ctx.style().visuals.faint_bg_color), .background_color(ctx.style().visuals.faint_bg_color),
); );
ui.end_row(); ui.end_row();
ui.end_row();
for binding in &whkdrc.bindings { for binding in &whkdrc.bindings {
if is_komorebic_binding(binding) {
let keys = binding.keys.join(" + "); let keys = binding.keys.join(" + ");
if self.filter.is_empty() if self.filter.is_empty() || binding.command.contains(&self.filter)
|| binding.command.contains(&self.filter)
{ {
ui.label(keys); ui.label(keys);
ui.label(&binding.command); ui.label(&binding.command);
@@ -75,7 +72,6 @@ impl eframe::App for Quicklook {
} }
} }
} }
}
}); });
}); });
}); });
@@ -100,7 +96,3 @@ fn main() {
) )
.unwrap(); .unwrap();
} }
fn is_komorebic_binding(binding: &HotkeyBinding) -> bool {
binding.command.starts_with("komorebic")
}