Skip to main content

Mountain/Command/Keybinding/
GetResolvedKeybinding.rs

1#![allow(non_snake_case)]
2
3//! Tauri command - fetch the final resolved keybindings (default +
4//! extension contributions + user overrides, weighted) for the keyboard
5//! shortcuts UI.
6
7use std::sync::Arc;
8
9use CommonLibrary::{Environment::Requires::Requires, Keybinding::KeybindingProvider::KeybindingProvider};
10use serde_json::Value;
11use tauri::{AppHandle, Manager, Wry, command};
12
13use crate::{RunTime::ApplicationRunTime::ApplicationRunTime as Runtime, dev_log};
14
15#[command]
16pub async fn GetResolvedKeybinding(ApplicationHandle:AppHandle<Wry>) -> Result<Value, String> {
17	dev_log!("keybinding", "getting resolved keybindings for UI");
18
19	let RunTime = ApplicationHandle.state::<Arc<Runtime>>().inner().clone();
20	let Provider:Arc<dyn KeybindingProvider> = RunTime.Environment.Require();
21
22	Provider.GetResolvedKeybinding().await.map_err(|Error| Error.to_string())
23}