feat: KeyEvents send modifier, so can quit on ctrl + c

This commit is contained in:
Jack Wills
2023-03-02 16:09:57 +00:00
parent 507660d835
commit 598f67c6f6
3 changed files with 28 additions and 13 deletions
+13 -8
View File
@@ -23,7 +23,10 @@ use docker_data::DockerData;
use input_handler::InputMessages;
use parking_lot::Mutex;
use parse_args::CliArgs;
use std::sync::{atomic::AtomicBool, Arc};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use tokio::sync::mpsc::{Receiver, Sender};
use tracing::{info, Level};
@@ -134,14 +137,16 @@ async fn main() {
if args.gui {
Ui::create(app_data, docker_sx, gui_state, is_running, input_sx).await;
} else {
// Debug mode for testing, mostly pointless, doesn't take terminal
info!("in debug mode");
loop {
docker_sx.send(DockerMessage::Update).await.unwrap_or(());
tokio::time::sleep(std::time::Duration::from_millis(u64::from(
args.docker_interval,
)))
.await;
while is_running.load(Ordering::SeqCst) {
// Debug mode for testing, mostly pointless, doesn't take terminal
loop {
docker_sx.send(DockerMessage::Update).await.unwrap_or(());
tokio::time::sleep(std::time::Duration::from_millis(u64::from(
args.docker_interval,
)))
.await;
}
}
}
}