From 832eb17a68e37f287206ec319a316ea91247808a Mon Sep 17 00:00:00 2001 From: Shav Kinderlehrer Date: Thu, 7 Mar 2024 09:34:25 -0500 Subject: Add default shortcuts + add flags for super key --- src/app.rs | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'src/app.rs') 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 { 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, -- cgit v1.2.3