|
|
|
@ -11,28 +11,24 @@ pub struct Hotkeys<'a> {
|
|
|
|
|
|
|
|
|
|
impl<'a> Hotkeys<'a> {
|
|
|
|
|
/// Gets an array of all hotkey names in OBS.
|
|
|
|
|
pub async fn list_hotkeys(&self) -> Result<Vec<String>> {
|
|
|
|
|
pub async fn list(&self) -> Result<Vec<String>> {
|
|
|
|
|
self.client
|
|
|
|
|
.send_message::<_, responses::Hotkeys>(Request::ListHotkeys)
|
|
|
|
|
.send_message::<_, responses::Hotkeys>(Request::List)
|
|
|
|
|
.await
|
|
|
|
|
.map(|h| h.hotkeys)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Triggers a hotkey using its name. See [`General::list_hotkeys`].
|
|
|
|
|
pub async fn trigger_hotkey_by_name(&self, name: &str) -> Result<()> {
|
|
|
|
|
pub async fn trigger_by_name(&self, name: &str) -> Result<()> {
|
|
|
|
|
self.client
|
|
|
|
|
.send_message(Request::TriggerHotkeyByName { name })
|
|
|
|
|
.send_message(Request::TriggerByName { name })
|
|
|
|
|
.await
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Triggers a hotkey using a sequence of keys.
|
|
|
|
|
pub async fn trigger_hotkey_by_key_sequence(
|
|
|
|
|
&self,
|
|
|
|
|
id: &str,
|
|
|
|
|
modifiers: KeyModifiers,
|
|
|
|
|
) -> Result<()> {
|
|
|
|
|
pub async fn trigger_by_sequence(&self, id: &str, modifiers: KeyModifiers) -> Result<()> {
|
|
|
|
|
self.client
|
|
|
|
|
.send_message(Request::TriggerHotkeyByKeySequence { id, modifiers })
|
|
|
|
|
.send_message(Request::TriggerBySequence { id, modifiers })
|
|
|
|
|
.await
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|