aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2024-03-23 13:08:14 -0400
committerShav Kinderlehrer <[email protected]>2024-03-23 13:08:14 -0400
commit0e29fa02995273bfd803aea48773cbe52a7366ed (patch)
treeefd8302cfc433c076010d94849fda224d36167d4 /src/main.rs
parent0c5e8ab544823fbb4936c536ee1d8a66298f7e51 (diff)
downloadmolehole-0e29fa02995273bfd803aea48773cbe52a7366ed.tar.gz
molehole-0e29fa02995273bfd803aea48773cbe52a7366ed.zip
Rework actions and events + start statusbar
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index ca87db6..33c2036 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,8 +8,53 @@ mod tui;
use eyre::Result;
+use app_action::AppAction;
+use keys::key_commands::KeyCommand;
+
fn main() -> Result<()> {
+ tui::install_hooks()?;
let mut app = app::App::new(std::time::Duration::from_millis(10))?;
+ let mut key_commands = vec![
+ // Status bar
+ KeyCommand {
+ key_code: "o".to_string(),
+ description: "Open new link".to_string(),
+ action: AppAction::OpenUrl,
+ },
+
+ // Navigation
+ KeyCommand {
+ key_code: "g".to_string(),
+ description: "Scroll to top".to_string(),
+ action: AppAction::ScrollTop,
+ },
+ KeyCommand {
+ key_code: "G".to_string(),
+ description: "Scroll to bottom".to_string(),
+ action: AppAction::ScrollBottom,
+ },
+ KeyCommand {
+ key_code: "k".to_string(),
+ description: "Scroll up one line".to_string(),
+ action: AppAction::ScrollUp,
+ },
+ KeyCommand {
+ key_code: "j".to_string(),
+ description: "Scroll down one line".to_string(),
+ action: AppAction::ScrollDown,
+ },
+ KeyCommand {
+ key_code: "q".to_string(),
+ description: "Quit molehole".to_string(),
+ action: AppAction::Quit,
+ },
+ KeyCommand {
+ key_code: "?".to_string(),
+ description: "Show help menu".to_string(),
+ action: AppAction::ShowHelpMenu
+ }
+ ];
+ app.key_commands.append(&mut key_commands);
app.run()
}