aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2024-03-07 09:34:25 -0500
committerShav Kinderlehrer <[email protected]>2024-03-07 09:34:25 -0500
commit832eb17a68e37f287206ec319a316ea91247808a (patch)
tree273aad6f124e080554f081c432c1d8f2a59b1a26 /src/app.rs
parentfa3e812a301455c7bc7b4d829a7fba01ddaea413 (diff)
downloadmolehole-832eb17a68e37f287206ec319a316ea91247808a.tar.gz
molehole-832eb17a68e37f287206ec319a316ea91247808a.zip
Add default shortcuts + add flags for super key
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/app.rs b/src/app.rs
index 03ba04a..17c8bc3 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -22,22 +22,43 @@ impl App {
pub fn new(tick_rate: Duration) -> Result<Self> {
let tui = tui::init()?;
- let key_commands = vec![KeyCommand {
- key_code: "q".to_string(),
- description: "Quit molehole".to_string(),
- action: Some(AppAction::Quit),
- }];
+ let key_commands = vec![
+ KeyCommand {
+ key_code: "q".to_string(),
+ description: "Quit molehole".to_string(),
+ action: Some(AppAction::Quit),
+ },
+ KeyCommand {
+ key_code: "g".to_string(),
+ description: "Scroll to top".to_string(),
+ action: None,
+ },
+ KeyCommand {
+ key_code: "G".to_string(),
+ description: "Scroll to bottom".to_string(),
+ action: None,
+ },
+ KeyCommand {
+ key_code: "k".to_string(),
+ description: "Scroll up one line".to_string(),
+ action: None,
+ },
+ KeyCommand {
+ key_code: "j".to_string(),
+ description: "Scroll down one line".to_string(),
+ action: None,
+ },
+ ];
let global_keys = components::global_keys::GlobalKeys {
key_commands: key_commands.clone(),
..Default::default()
};
- let hello_world = components::hello_world::HelloWorld::default();
Ok(Self {
tui,
tick_rate,
- components: vec![Box::new(hello_world), Box::new(global_keys)],
+ components: vec![Box::new(global_keys)],
key_commands,
should_quit: false,