Skip to content

Commit

Permalink
fix(app): enable focus change events on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ja-ko committed Jun 2, 2024
1 parent 9963f74 commit 07d94f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tui.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{io, panic};
use std::collections::HashMap;
use crossterm::event::KeyEvent;
use crossterm::event::{DisableFocusChange, EnableFocusChange, KeyEvent};
use crossterm::terminal;
use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen};
use log::{debug};
Expand Down Expand Up @@ -31,7 +31,7 @@ impl<B: Backend> Tui<B> {
}
pub fn init(&mut self) -> AppResult<()> {
terminal::enable_raw_mode()?;
crossterm::execute!(io::stderr(), EnterAlternateScreen)?;
crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableFocusChange)?;

let panic_hook = panic::take_hook();
panic::set_hook(Box::new(move |panic| {
Expand Down Expand Up @@ -60,7 +60,7 @@ impl<B: Backend> Tui<B> {

fn reset() -> AppResult<()> {
terminal::disable_raw_mode()?;
crossterm::execute!(io::stderr(), LeaveAlternateScreen)?;
crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableFocusChange)?;
Ok(())
}

Expand Down

0 comments on commit 07d94f6

Please sign in to comment.