diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.rs | 12 | ||||
-rw-r--r-- | src/main.rs | 4 |
2 files changed, 9 insertions, 7 deletions
@@ -1,17 +1,17 @@ | |||
1 | use std::default::Default; | 1 | use std::default::Default; |
2 | use std::f64; | 2 | use std::f64; |
3 | use std::time::Duration; | ||
4 | use std::fs::{File, OpenOptions}; | 3 | use std::fs::{File, OpenOptions}; |
5 | use std::io::prelude::*; | 4 | use std::io::prelude::*; |
6 | use std::path::PathBuf; | 5 | use std::path::PathBuf; |
7 | use std::sync::mpsc::{channel, Receiver}; | 6 | use std::sync::mpsc::{channel, Receiver}; |
7 | use std::time::Duration; | ||
8 | 8 | ||
9 | use chrono::Local; | 9 | use chrono::Local; |
10 | use cursive::direction::{Absolute, Direction}; | 10 | use cursive::direction::{Absolute, Direction}; |
11 | use cursive::event::{Event, EventResult, Key}; | 11 | use cursive::event::{Event, EventResult, Key}; |
12 | use cursive::view::View; | 12 | use cursive::view::View; |
13 | use cursive::{Printer, Vec2}; | 13 | use cursive::{Printer, Vec2}; |
14 | use notify::{watcher, RecursiveMode, Watcher, DebouncedEvent, INotifyWatcher}; | 14 | use notify::{watcher, DebouncedEvent, INotifyWatcher, RecursiveMode, Watcher}; |
15 | 15 | ||
16 | use crate::habit::{Bit, Count, HabitWrapper, TrackEvent, ViewMode}; | 16 | use crate::habit::{Bit, Count, HabitWrapper, TrackEvent, ViewMode}; |
17 | use crate::utils; | 17 | use 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}; | |||
12 | use crate::utils::{load_configuration_file, AppConfig}; | 12 | use crate::utils::{load_configuration_file, AppConfig}; |
13 | 13 | ||
14 | use clap::{App as ClapApp, Arg}; | 14 | use clap::{App as ClapApp, Arg}; |
15 | use cursive::ncurses; | 15 | use cursive::termion; |
16 | use cursive::views::NamedView; | 16 | use cursive::views::NamedView; |
17 | use lazy_static::lazy_static; | 17 | use 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)); |