aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.rs12
-rw-r--r--src/main.rs4
2 files changed, 9 insertions, 7 deletions
diff --git a/src/app.rs b/src/app.rs
index e8273e3..52c7f5f 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,17 +1,17 @@
1use std::default::Default; 1use std::default::Default;
2use std::f64; 2use std::f64;
3use std::time::Duration;
4use std::fs::{File, OpenOptions}; 3use std::fs::{File, OpenOptions};
5use std::io::prelude::*; 4use std::io::prelude::*;
6use std::path::PathBuf; 5use std::path::PathBuf;
7use std::sync::mpsc::{channel, Receiver}; 6use std::sync::mpsc::{channel, Receiver};
7use std::time::Duration;
8 8
9use chrono::Local; 9use chrono::Local;
10use cursive::direction::{Absolute, Direction}; 10use cursive::direction::{Absolute, Direction};
11use cursive::event::{Event, EventResult, Key}; 11use cursive::event::{Event, EventResult, Key};
12use cursive::view::View; 12use cursive::view::View;
13use cursive::{Printer, Vec2}; 13use cursive::{Printer, Vec2};
14use notify::{watcher, RecursiveMode, Watcher, DebouncedEvent, INotifyWatcher}; 14use notify::{watcher, DebouncedEvent, INotifyWatcher, RecursiveMode, Watcher};
15 15
16use crate::habit::{Bit, Count, HabitWrapper, TrackEvent, ViewMode}; 16use crate::habit::{Bit, Count, HabitWrapper, TrackEvent, ViewMode};
17use crate::utils; 17use crate::utils;
@@ -40,9 +40,11 @@ impl App {
40 pub fn new() -> Self { 40 pub fn new() -> Self {
41 let (tx, rx) = channel(); 41 let (tx, rx) = channel();
42 let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); 42 let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap();
43 watcher.watch(utils::auto_habit_file(), RecursiveMode::Recursive).unwrap_or_else(|e| { 43 watcher
44 panic!("Unable to start file watcher: {}", e); 44 .watch(utils::auto_habit_file(), RecursiveMode::Recursive)
45 }); 45 .unwrap_or_else(|e| {
46 panic!("Unable to start file watcher: {}", e);
47 });
46 return App { 48 return App {
47 habits: vec![], 49 habits: vec![],
48 focus: 0, 50 focus: 0,
diff --git a/src/main.rs b/src/main.rs
index 3efecd6..dc6081d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,7 +12,7 @@ use crate::command::{open_command_window, Command};
12use crate::utils::{load_configuration_file, AppConfig}; 12use crate::utils::{load_configuration_file, AppConfig};
13 13
14use clap::{App as ClapApp, Arg}; 14use clap::{App as ClapApp, Arg};
15use cursive::ncurses; 15use cursive::termion;
16use cursive::views::NamedView; 16use cursive::views::NamedView;
17use lazy_static::lazy_static; 17use lazy_static::lazy_static;
18 18
@@ -44,7 +44,7 @@ fn main() {
44 eprintln!("Invalid or unsupported command!"); 44 eprintln!("Invalid or unsupported command!");
45 } 45 }
46 } else { 46 } else {
47 let mut s = ncurses().unwrap(); 47 let mut s = termion().unwrap();
48 let app = App::load_state(); 48 let app = App::load_state();
49 s.add_layer(NamedView::new("Main", app)); 49 s.add_layer(NamedView::new("Main", app));
50 s.add_global_callback(':', |s| open_command_window(s)); 50 s.add_global_callback(':', |s| open_command_window(s));