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:
2026-10-28 15:50:05 +01:00
parent c3eb70191b
commit 18e8b3ecb8
29 changed files with 520 additions and 68 deletions

View File

@@ -6,6 +6,16 @@ pub const LEFT_SHIFT: u16 = 42;
pub const RIGHT_SHIFT: u16 = 54;
pub const LEFT_CTRL: u16 = 29;
pub const RIGHT_CTRL: u16 = 97;
pub const LEFT_ALT: u16 = 56;
pub const RIGHT_ALT: u16 = 100;
/// Alt+Tab is the display's window switch, the same key as F1
/// (`types::display::window::SWITCH_KEY`).
const SWITCH: Key = Key::Function(1);
/// What a key is with Alt held: only Alt+Tab means anything.
pub fn with_alt(key: Key) -> Option<Key> {
(key == Key::Tab).then_some(SWITCH)
}
/// A letter typed with Ctrl held is its control character, as on a
/// terminal: Ctrl+C is 3. Anything else is itself.
@@ -54,6 +64,12 @@ pub fn key(code: u16, shift: bool) -> Option<Key> {
mod tests {
use super::*;
#[test]
fn alt_tab_switches_windows_and_other_alt_keys_are_nothing() {
assert_eq!(with_alt(Key::Tab), Some(Key::Function(1)));
assert_eq!(with_alt(Key::Char(b'a')), None);
}
#[test]
fn function_keys_are_numbered() {
assert_eq!(key(59, false), Some(Key::Function(1)));

View File

@@ -36,6 +36,7 @@ pub struct VirtioInputDevice {
next_avail: u16,
shift: bool,
ctrl: bool,
alt: bool,
}
impl VirtioInputDevice {
@@ -61,6 +62,7 @@ impl VirtioInputDevice {
next_avail: 0,
shift: false,
ctrl: false,
alt: false,
};
dev.fill_queue();
Some(dev)
@@ -129,8 +131,13 @@ impl InputDevice for VirtioInputDevice {
self.ctrl = ev_value != 0;
continue;
}
if ev_type == EV_KEY && matches!(ev_code, keymap::LEFT_ALT | keymap::RIGHT_ALT) {
self.alt = ev_value != 0;
continue;
}
if ev_type == EV_KEY {
let key = keymap::key(ev_code, self.shift).map(|k| if self.ctrl { keymap::with_ctrl(k) } else { k });
let key = if self.alt { key.and_then(keymap::with_alt) } else { key };
if let Some(key) = key {
if ev_value == KEY_PRESS {
return Some(InputEvent::KeyDown(key));