Skip to main content

Mountain/Command/Keybinding/
GetResolvedKeybinding.rs

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