mirror of
https://github.com/apognu/tuigreet.git
synced 2024-09-11 07:25:29 +03:00
Prevent event processing while working.
This commit is contained in:
parent
8d24e412c9
commit
c8e4c9b2b3
@ -25,6 +25,10 @@ use crate::{
|
||||
pub async fn handle(greeter: Arc<RwLock<Greeter>>, input: KeyEvent, ipc: Ipc) -> Result<(), Box<dyn Error>> {
|
||||
let mut greeter = greeter.write().await;
|
||||
|
||||
if greeter.working {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
match input {
|
||||
// ^U should erase the current buffer.
|
||||
KeyEvent {
|
||||
|
@ -39,7 +39,7 @@ async fn main() {
|
||||
|
||||
async fn run() -> Result<(), Box<dyn Error>> {
|
||||
let mut events = Events::new().await;
|
||||
let greeter = Greeter::new(events.sender()).await;
|
||||
let mut greeter = Greeter::new(events.sender()).await;
|
||||
let mut stdout = io::stdout();
|
||||
|
||||
register_panic_handler();
|
||||
@ -55,6 +55,8 @@ async fn run() -> Result<(), Box<dyn Error>> {
|
||||
let ipc = Ipc::new();
|
||||
|
||||
if greeter.remember && !greeter.username.value.is_empty() {
|
||||
greeter.working = true;
|
||||
|
||||
ipc
|
||||
.send(Request::CreateSession {
|
||||
username: greeter.username.value.clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user