Add a global ToggleDictation keybinding
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use gpui::Action;
|
||||
use gpui::{Action, actions};
|
||||
use nostr_sdk::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use settings::SignerKind;
|
||||
@@ -15,3 +15,6 @@ pub enum Command {
|
||||
Njump(PublicKey),
|
||||
Trace(EventId),
|
||||
}
|
||||
|
||||
// Start or stop dictation in the focused composer
|
||||
actions!(chat, [ToggleDictation]);
|
||||
|
||||
@@ -882,6 +882,17 @@ impl ChatPanel {
|
||||
self.directory.read(cx).person(public_key, cx)
|
||||
}
|
||||
|
||||
fn toggle_dictation(
|
||||
&mut self,
|
||||
_: &ToggleDictation,
|
||||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
self.speech.update(cx, |speech, cx| {
|
||||
speech.toggle(cx);
|
||||
});
|
||||
}
|
||||
|
||||
fn on_command(&mut self, command: &Command, window: &mut Window, cx: &mut Context<Self>) {
|
||||
match command {
|
||||
Command::Insert(content) => {
|
||||
@@ -1871,6 +1882,7 @@ impl Render for ChatPanel {
|
||||
v_flex()
|
||||
.image_cache(retain_all(self.id.clone()))
|
||||
.on_action(cx.listener(Self::on_command))
|
||||
.on_action(cx.listener(Self::toggle_dictation))
|
||||
.size_full()
|
||||
.when(*self.subject_bar.read(cx), |this| {
|
||||
this.child(
|
||||
|
||||
Reference in New Issue
Block a user