summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/config
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-08-13 07:50:21 +0000
committerjoeac <me@joeac.net>2025-08-13 07:50:21 +0000
commitee3cd780e21260257b401c3f5cbababd9e27a15a (patch)
treeb0571649a1a1a7644dbc50183cc4c3a29966a963 /schist_desktop_gui/src/config
parent49342e8b553d5c92f1c043b3b0ce18bdf1c2cd44 (diff)
task-073
Co-authored-by: Joe Carstairs <jcarstairs@scottlogic.com> Reviewed-on: https://git.joeac.net/joeac/schist/pulls/1 Co-authored-by: Joe Carstairs <me@joeac.net> Co-committed-by: Joe Carstairs <me@joeac.net>
Diffstat (limited to 'schist_desktop_gui/src/config')
-rw-r--r--schist_desktop_gui/src/config/keys.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/config/keys.rs b/schist_desktop_gui/src/config/keys.rs
new file mode 100644
index 0000000..ff28757
--- /dev/null
+++ b/schist_desktop_gui/src/config/keys.rs
@@ -0,0 +1,45 @@
+// Borrowed from https://github.com/squidowl/halloy/tree/main/data/src/config/keys.rs
+
+use crate::{
+ gui::screens::main_screen::View,
+ shortcut::{shortcut, Command, KeyBind, Shortcut},
+};
+
+#[derive(Debug, Clone)]
+pub struct Keyboard {
+ pub goto_next_item: KeyBind,
+ pub goto_prev_item: KeyBind,
+ pub goto_next_view: KeyBind,
+ pub goto_prev_view: KeyBind,
+ pub goto_view_1: KeyBind,
+ pub goto_view_2: KeyBind,
+ pub goto_view_3: KeyBind,
+}
+
+impl Default for Keyboard {
+ fn default() -> Self {
+ Self {
+ goto_next_item: KeyBind::goto_next_item(),
+ goto_prev_item: KeyBind::goto_prev_item(),
+ goto_next_view: KeyBind::goto_next_view(),
+ goto_prev_view: KeyBind::goto_prev_view(),
+ goto_view_1: KeyBind::goto_view_1(),
+ goto_view_2: KeyBind::goto_view_2(),
+ goto_view_3: KeyBind::goto_view_3(),
+ }
+ }
+}
+
+impl Keyboard {
+ pub fn shortcuts(&self) -> Vec<Shortcut> {
+ vec![
+ shortcut(self.goto_next_item.clone(), Command::GotoNextItem),
+ shortcut(self.goto_prev_item.clone(), Command::GotoPrevItem),
+ shortcut(self.goto_next_view.clone(), Command::GotoNextView),
+ shortcut(self.goto_prev_view.clone(), Command::GotoPrevView),
+ shortcut(self.goto_view_1.clone(), Command::GotoView(View::VIEW_1)),
+ shortcut(self.goto_view_2.clone(), Command::GotoView(View::VIEW_2)),
+ shortcut(self.goto_view_3.clone(), Command::GotoView(View::VIEW_3)),
+ ]
+ }
+}