DEVELOPMENT ENVIRONMENT

~liljamo/gandalf

ref: 6b9e1364cfca46410e38fbdc64e5b39c55dab7d6 gandalf/src/input.rs -rw-r--r-- 441 bytes
6b9e1364Jonni Liljamo fix: disable exit on unfocus, broken on sway 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
use iced::keyboard;

use crate::gandalf::Message;

pub fn handle(key_code: keyboard::KeyCode) -> Option<Message> {
    match key_code {
        keyboard::KeyCode::Up => Some(Message::MoveCursor(true)),
        keyboard::KeyCode::Down | keyboard::KeyCode::Tab => Some(Message::MoveCursor(false)),
        keyboard::KeyCode::Enter => Some(Message::Execute),
        keyboard::KeyCode::Escape => Some(Message::Exit),
        _ => None,
    }
}