feat(desktop): home app (system-only launch cap, LAUNCH_BADGE: apps+launch only), pm starts it with session (relaunch <=5); display keys F1/Alt+Tab next, F2 home, F4 close app (ROLE from launcher, terminal exempt), close returns to previous window; closed window -> app exits; shell 'name &'; launch by id; pm stack 8, storage 16 clients
This commit is contained in:
@@ -77,25 +77,23 @@ enum Input {
|
||||
Other,
|
||||
}
|
||||
|
||||
/// The next key, if one is waiting: q or Escape quits.
|
||||
/// The next key, if one is waiting: q or Escape quits, and so does the
|
||||
/// window going.
|
||||
fn next_input(window: CapSlot) -> Input {
|
||||
let Ok([tag, kind, ch, _]) = syscall::request(window, [types::display::window::POLL, 0, 0, 0]) else {
|
||||
return Input::None;
|
||||
};
|
||||
if tag == 0 {
|
||||
return Input::None; // NoEvent: queue drained
|
||||
}
|
||||
if tag != 1 {
|
||||
return Input::Other; // a key let go
|
||||
}
|
||||
// Arrows, or WASD (kind 9 is a character).
|
||||
match (kind, ch as u8) {
|
||||
(5, _) | (9, b'q') => Input::Quit,
|
||||
(0, _) | (9, b'w') => Input::Turn(Direction::Up),
|
||||
(1, _) | (9, b's') => Input::Turn(Direction::Down),
|
||||
(2, _) | (9, b'a') => Input::Turn(Direction::Left),
|
||||
(3, _) | (9, b'd') => Input::Turn(Direction::Right),
|
||||
_ => Input::Other,
|
||||
use libkos::display::Event;
|
||||
use libkos::input::{InputEvent, Key};
|
||||
match libkos::display::poll(window) {
|
||||
None => Input::None,
|
||||
Some(Event::Closed) => Input::Quit,
|
||||
Some(Event::Input(InputEvent::KeyDown(k))) => match k {
|
||||
Key::Escape | Key::Char(b'q') => Input::Quit,
|
||||
Key::Up | Key::Char(b'w') => Input::Turn(Direction::Up),
|
||||
Key::Down | Key::Char(b's') => Input::Turn(Direction::Down),
|
||||
Key::Left | Key::Char(b'a') => Input::Turn(Direction::Left),
|
||||
Key::Right | Key::Char(b'd') => Input::Turn(Direction::Right),
|
||||
_ => Input::Other,
|
||||
},
|
||||
Some(_) => Input::Other,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user