mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 12:05:34 +00:00
parent
d68ae21630
commit
1934d3f03f
@ -74,7 +74,7 @@ theme = "TwoDark"
|
|||||||
# ------------------------
|
# ------------------------
|
||||||
[keybindings.Channel]
|
[keybindings.Channel]
|
||||||
# Quit the application
|
# Quit the application
|
||||||
quit = "esc"
|
quit = ["esc", "ctrl-c"]
|
||||||
# Scrolling through entries
|
# Scrolling through entries
|
||||||
select_next_entry = ["down", "ctrl-n", "ctrl-j"]
|
select_next_entry = ["down", "ctrl-n", "ctrl-j"]
|
||||||
select_prev_entry = ["up", "ctrl-p", "ctrl-k"]
|
select_prev_entry = ["up", "ctrl-p", "ctrl-k"]
|
||||||
|
@ -14,7 +14,7 @@ use crossterm::event::{
|
|||||||
KeyEvent, KeyEventKind, KeyModifiers,
|
KeyEvent, KeyEventKind, KeyModifiers,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::sync::mpsc;
|
use tokio::{signal, sync::mpsc};
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
@ -160,7 +160,6 @@ impl EventLoop {
|
|||||||
//let mut reader = crossterm::event::EventStream::new();
|
//let mut reader = crossterm::event::EventStream::new();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
//let event = reader.next();
|
|
||||||
let delay = tokio::time::sleep(tick_interval);
|
let delay = tokio::time::sleep(tick_interval);
|
||||||
let event_available = poll_event(tick_interval);
|
let event_available = poll_event(tick_interval);
|
||||||
|
|
||||||
@ -171,6 +170,10 @@ impl EventLoop {
|
|||||||
tx.send(Event::Tick).unwrap_or_else(|_| warn!("Unable to send Tick event"));
|
tx.send(Event::Tick).unwrap_or_else(|_| warn!("Unable to send Tick event"));
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
|
_ = signal::ctrl_c() => {
|
||||||
|
debug!("Received SIGINT");
|
||||||
|
tx.send(Event::Input(Key::Ctrl('c'))).unwrap_or_else(|_| warn!("Unable to send Ctrl-C event"));
|
||||||
|
},
|
||||||
// if `delay` completes, pass to the next event "frame"
|
// if `delay` completes, pass to the next event "frame"
|
||||||
() = delay => {
|
() = delay => {
|
||||||
tx.send(Event::Tick).unwrap_or_else(|_| warn!("Unable to send Tick event"));
|
tx.send(Event::Tick).unwrap_or_else(|_| warn!("Unable to send Tick event"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user