a11y: add keyboard shortcuts
This commit is contained in:
parent
499723d11e
commit
8a328e1bd6
|
@ -27,6 +27,30 @@
|
|||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">About</property>
|
||||
<property name="action-name">app.about</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Preferences</property>
|
||||
<property name="action-name">app.preferences</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Copy response</property>
|
||||
<property name="action-name">app.copy_bot</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Clear</property>
|
||||
<property name="action-name">app.clear</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
12
src/main.py
12
src/main.py
|
@ -51,11 +51,12 @@ class BavarderApplication(Adw.Application):
|
|||
flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
|
||||
)
|
||||
self.create_action("quit", self.on_quit, ["<primary>q"])
|
||||
self.create_action("about", self.on_about_action)
|
||||
self.create_action("preferences", self.on_preferences_action)
|
||||
self.create_action("about", self.on_about_action, ["<primary>a"])
|
||||
self.create_action("preferences", self.on_preferences_action, ["<primary>p"])
|
||||
self.create_action("copy_prompt", self.on_copy_prompt_action)
|
||||
self.create_action("copy_bot", self.on_copy_bot_action)
|
||||
self.create_action("copy_bot", self.on_copy_bot_action, ["<primary>c"])
|
||||
self.create_action("ask", self.on_ask_action, ["<primary>Return"])
|
||||
self.create_action("clear", self.on_clear_action, ["<primary>BackSpace"])
|
||||
# self.create_action("speak", self.on_speak_action, ["<primary>S"])
|
||||
# self.create_action("listen", self.on_listen_action, ["<primary>L"])
|
||||
|
||||
|
@ -90,6 +91,11 @@ class BavarderApplication(Adw.Application):
|
|||
data = GLib.Variant("a{ss}", r)
|
||||
self.settings.set_value("providers-data", data)
|
||||
|
||||
def on_clear_action(self, action, param):
|
||||
self.win.bot_text_view.get_buffer().set_text("")
|
||||
self.win.prompt_text_view.get_buffer().set_text("")
|
||||
self.win.prompt_text_view.grab_focus()
|
||||
|
||||
def get_provider(self):
|
||||
print(self.providers)
|
||||
return self.providers[self.win.provider_selector.props.selected]
|
||||
|
|
Loading…
Reference in New Issue
Block a user