Mountain/Command/
Keybinding.rs

1//! # Keybinding Commands
2//!
3//! Defines the specific Tauri command handlers for Keybinding data requests
4//! that originate from the `Sky` frontend UI.
5
6#![allow(non_snake_case, non_camel_case_types)]
7
8use std::sync::Arc;
9
10use Common::{Environment::Requires::Requires, Keybinding::KeybindingProvider::KeybindingProvider};
11use serde_json::Value;
12use tauri::{AppHandle, Manager, Wry, command};
13
14use crate::RunTime::ApplicationRunTime::ApplicationRunTime as MountainRunTime;
15
16#[command]
17pub async fn GetResolvedKeybinding(ApplicationHandle:AppHandle<Wry>) -> Result<Value, String> {
18	log::debug!("[Keybinding Command] Getting resolved keybindings for UI.");
19
20	let RunTime = ApplicationHandle.state::<Arc<MountainRunTime>>().inner().clone();
21
22	let Provider:Arc<dyn KeybindingProvider> = RunTime.Environment.Require();
23
24	Provider.GetResolvedKeybinding().await.map_err(|Error| Error.to_string())
25}