git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit5682c361c5ef4b83b9ae223cdc29e78056e4eb28
parent3e8c367add
authorLucas Galante <[email protected]>
date2026-07-16 12:16
feat(input): app_chord helper for per-app binding resolution

One-line idiom for clients: resolve <app>.<name> -> cce-ui.<name> ->
compiled default, with the app domain taken from the binary name.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PXSsCppeDFmSRRM5NAug5a

 src/input.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/input.rs b/src/input.rs
index c35aaf0..5b6e6cf 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -349,6 +349,17 @@ pub fn cached() -> &'static InputConfig {
     CACHED.get_or_init(InputConfig::load)
 }
 
+/// Chord for one of this app's bindings: `<app>.<name>` → `cce-ui.<name>` →
+/// the compiled-in default. The app domain is the binary name. This is the
+/// standard way for a client to resolve its shortcuts at startup:
+///
+///     let open = cce_ui::input::app_chord("open_file", "enter");
+///     ... cce_ui::widget::match_key_shortcut(event, &open) ...
+pub fn app_chord(name: &str, default: &str) -> String {
+    let app = crate::config::get_app_name().unwrap_or_default();
+    cached().resolve_chord(&app, name, default)
+}
+
 /// This app's effective wheel-delta multipliers, resolved once per process.
 /// Pixel (smooth) deltas scale by `trackpad`, discrete clicks by `mouse`.
 #[derive(Debug, Clone, Copy, PartialEq)]