From 72dda72432f7bde30a6879df209deb24c7abf185 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 20:21:26 +0000 Subject: [PATCH 1/4] fix(compositor): show the shell on a Super key tap From an application window there was no keyboard path to the system shell: only a pointer click on the taskbar strip raised the panel. The Super keys now belong to the compositor and are never delivered to an application. A tap, Super pressed and released without another key, activates the shell's panel, raising it with keyboard focus, and then delivers the tap to it so the shell can open its launcher; a key or a pointer button pressed meanwhile makes it no tap. Keys pressed while Super is held reach the focused window with the Super modifier: a client is sent the modifiers whenever a key the compositor takes changes them, so none stays held there. With several panels, the first registered one is the shell's. --- crates/weft-compositor/src/input.rs | 119 +++++++++++++++++++------- crates/weft-compositor/src/state.rs | 4 + crates/weft-compositor/src/windows.rs | 39 +++++++-- docs/security.md | 2 +- 4 files changed, 126 insertions(+), 38 deletions(-) diff --git a/crates/weft-compositor/src/input.rs b/crates/weft-compositor/src/input.rs index e5e1721..28069b0 100644 --- a/crates/weft-compositor/src/input.rs +++ b/crates/weft-compositor/src/input.rs @@ -6,7 +6,7 @@ use smithay::{ TouchEvent, }, input::{ - keyboard::FilterResult, + keyboard::{FilterResult, KeyboardTarget}, pointer::{AxisFrame, ButtonEvent, MotionEvent}, }, utils::{Logical, Point, SERIAL_COUNTER}, @@ -42,41 +42,97 @@ pub fn process_input_event(state: &mut WeftCompositorState, eve } } +/// What the compositor does with a key instead of forwarding it. +enum Shortcut { + /// Alt+F4: close the focused application window. + Close, + /// A Super key tap: show the shell. + Shell, + /// Nothing: a suppressed key. + None, +} + fn handle_keyboard(state: &mut WeftCompositorState, event: B::KeyboardKeyEvent) { + use smithay::backend::input::KeyState; + use smithay::input::keyboard::keysyms; + let serial = SERIAL_COUNTER.next_serial(); let time = event.time_msec(); let key_state = event.state(); + let Some(keyboard) = state.seat.get_keyboard() else { + return; + }; - if let Some(keyboard) = state.seat.get_keyboard() { - // Alt+F4 belongs to the compositor: it asks the focused application - // window to close, and the key never reaches a client. - let close = keyboard.input::( - state, - event.key_code(), - key_state, - serial, - time, - |state, mods, keysym| { - // A release is taken only when its press was, so no client - // sees half of a key. - let code = keysym.raw_code().raw(); - if key_state == smithay::backend::input::KeyState::Pressed { - if mods.alt - && keysym.modified_sym() == smithay::input::keyboard::keysyms::KEY_F4.into() - { - state.suppressed_keys.push(code); - return FilterResult::Intercept(true); - } - } else if let Some(i) = state.suppressed_keys.iter().position(|&k| k == code) { - state.suppressed_keys.remove(i); - return FilterResult::Intercept(false); + // Alt+F4 and the Super keys belong to the compositor. Alt+F4 asks the + // focused application window to close. Super's key events are never + // delivered to an application: tapped alone, without another key or a + // button, it brings the shell's panel to the front with keyboard focus + // and is then delivered to the shell, which opens or closes its + // launcher. Held, it still sets the Super modifier for other keys. + let (filtered, mods_changed) = keyboard.input_intercept::<_, _>( + state, + event.key_code(), + key_state, + |state, mods, keysym| { + // A release is taken only when its press was, so no client + // sees half of a key. + let code = keysym.raw_code().raw(); + let sym = keysym.modified_sym(); + if key_state == KeyState::Pressed { + if mods.alt && sym == keysyms::KEY_F4.into() { + state.super_tap = None; + state.suppressed_keys.push(code); + return FilterResult::Intercept(Shortcut::Close); } - FilterResult::Forward - }, - ); - if close == Some(true) { - state.close_focused_window(); + if sym == keysyms::KEY_Super_L.into() || sym == keysyms::KEY_Super_R.into() { + state.super_tap = (!mods.ctrl && !mods.alt && !mods.shift).then_some(code); + state.suppressed_keys.push(code); + return FilterResult::Intercept(Shortcut::None); + } + state.super_tap = None; + } else if let Some(i) = state.suppressed_keys.iter().position(|&k| k == code) { + state.suppressed_keys.remove(i); + if state.super_tap.take() == Some(code) { + return FilterResult::Intercept(Shortcut::Shell); + } + return FilterResult::Intercept(Shortcut::None); + } + FilterResult::Forward + }, + ); + let shortcut = match filtered { + FilterResult::Forward => { + keyboard.input_forward( + state, + event.key_code(), + key_state, + serial, + time, + mods_changed, + ); + return; } + FilterResult::Intercept(shortcut) => shortcut, + }; + // The focused client follows the modifiers even when the key that + // changed them is taken, so none stays held there. + if mods_changed && let Some(focus) = keyboard.current_focus() { + let seat = state.seat.clone(); + focus.modifiers(&seat, state, keyboard.modifier_state(), serial); + } + match shortcut { + Shortcut::Close => state.close_focused_window(), + Shortcut::Shell => { + if state.activate_panel() { + // The tap itself, for the shell; the keyboard's own state + // already saw it. + let code = event.key_code(); + keyboard.input_forward(state, code, KeyState::Pressed, serial, time, false); + let release = SERIAL_COUNTER.next_serial(); + keyboard.input_forward(state, code, KeyState::Released, release, time, false); + } + } + Shortcut::None => {} } } @@ -144,8 +200,10 @@ fn handle_pointer_button( let button_state = event.state(); // On press: activate the window under the pointer, which raises an - // application window and focuses it. + // application window and focuses it. A held Super key is then no + // longer a tap. if button_state == ButtonState::Pressed { + state.super_tap = None; let pointer_location = state.pointer_location; let window = state .space @@ -221,6 +279,7 @@ fn handle_pointer_axis( } fn handle_touch_down(state: &mut WeftCompositorState, event: B::TouchDownEvent) { + state.super_tap = None; let serial = SERIAL_COUNTER.next_serial(); let output = state.space.outputs().next().cloned(); if let Some(output) = output { diff --git a/crates/weft-compositor/src/state.rs b/crates/weft-compositor/src/state.rs index 79b701c..9eb8ba5 100644 --- a/crates/weft-compositor/src/state.rs +++ b/crates/weft-compositor/src/state.rs @@ -101,6 +101,9 @@ pub struct WeftCompositorState { /// Keycodes whose press a compositor shortcut took, so their release is /// taken as well and no client sees half of a key. pub suppressed_keys: Vec, + /// The Super key held down while no other key was pressed since; its + /// release is a tap that opens the shell. + pub super_tap: Option, pub compositor_state: CompositorState, pub xdg_shell_state: XdgShellState, @@ -200,6 +203,7 @@ impl WeftCompositorState { running: true, gesture_state: GestureState::default(), suppressed_keys: Vec::new(), + super_tap: None, #[cfg(unix)] appd_ipc: None, #[cfg(target_os = "linux")] diff --git a/crates/weft-compositor/src/windows.rs b/crates/weft-compositor/src/windows.rs index 2d7b527..ff0b306 100644 --- a/crates/weft-compositor/src/windows.rs +++ b/crates/weft-compositor/src/windows.rs @@ -4,13 +4,13 @@ //! panel fills the output and starts beneath every application window; //! application windows fill the work area, the output less the strips the //! panel reserves. A session's first window, a clicked window (the panel -//! included, which then shows the shell's home over the applications) and -//! one appd asks to activate is raised to the top, marked activated and -//! given keyboard focus; apart from a panel being lowered when it -//! registers, nothing else changes the order, and a window that maps -//! without taking focus goes beneath the window in front. When the -//! focused window closes, the topmost remaining application window gets -//! focus. +//! included, which then shows the shell's home over the applications), one +//! appd asks to activate and the panel when a Super key is tapped are +//! raised to the top, marked activated and given keyboard focus; apart +//! from a panel being lowered when it registers, nothing else changes the +//! order, and a window that maps without taking focus goes beneath the +//! window in front. When the focused window closes, the topmost remaining +//! application window gets focus. use smithay::desktop::Window; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; @@ -58,6 +58,31 @@ impl WeftCompositorState { } } + /// Activates the shell's panel; returns whether one is registered. With + /// several, the first registered is the shell's. + pub fn activate_panel(&mut self) -> bool { + let panel = self + .weft_shell_state + .panels() + .filter(|p| p.is_alive()) + .find_map(|panel| { + let surface = panel + .data::() + .and_then(|data| data.surface.clone())?; + self.space + .elements() + .find(|window| window.wl_surface().is_some_and(|s| *s == surface)) + .cloned() + }); + match panel { + Some(panel) => { + self.activate_window(&panel); + true + } + None => false, + } + } + /// Asks the focused application window to close. Its client decides /// how to end; for an app shell that ends the session. The panel is not /// closed this way. diff --git a/docs/security.md b/docs/security.md index d9c2bb3..b65315c 100644 --- a/docs/security.md +++ b/docs/security.md @@ -32,7 +32,7 @@ For verified read-only package storage, `weft-pack build-image` produces an EROF Each app shell is given exactly one Wayland connection, created for its session. weft-appd creates a connected socket pair, gives one end to the app shell as its standard input with `WAYLAND_SOCKET=0` and no `WAYLAND_DISPLAY`, and sends the other end to the compositor over the compositor IPC socket (`SCM_RIGHTS`) with the session ID and app ID. The compositor adds that end as a client bound to the session; the binding comes from appd holding the connection, never from an ID or process ID the client supplies. A session's `zweft_shell` windows carry the session's app ID whatever the client requests, and the shell-only `panel` and `overlay` roles are refused with a protocol error; layer-shell surfaces and the input-method interface are not offered to session clients at all. When the session ends, the compositor closes its client; when the client disconnects, the compositor reports it to appd; when appd's connection ends, the compositor closes every session client appd attached. The compositor accepts one appd connection at a time. A launch is refused (503) while appd is not connected to the compositor, rather than starting an app that could never show a window; if the compositor connection is lost before the session's connection is handed over, the session is stopped before the app shell starts. Frames for appd that its socket cannot take at once are queued and retried; a backlog beyond 4 MiB, from an appd that stopped reading, ends the connection and with it the sessions' clients. -Not yet covered: the compositor IPC socket accepts any process of the user while no appd is connected, so the first connection after a restart is trusted as appd; close is not yet decided by the compositor per session; there is no user placement or resizing, since application windows fill the work area the panel leaves, one in front at a time; only the first window a session maps in its lifetime takes keyboard focus when it maps, and a client connected through the display socket takes focus on map only while no other such window is mapped; and the trusted system shell is identified only by connecting through the display socket, which any process of the user, including an app shell, can open. +Not yet covered: the compositor IPC socket accepts any process of the user while no appd is connected, so the first connection after a restart is trusted as appd; close is not yet decided by the compositor per session; there is no user placement or resizing, since application windows fill the work area the panel leaves, one in front at a time; only the first window a session maps in its lifetime takes keyboard focus when it maps, and a client connected through the display socket takes focus on map only while no other such window is mapped; and the trusted system shell is identified only by connecting through the display socket, which any process of the user, including an app shell, can open. Such a client registered as a panel would also be raised and focused by a Super tap; the compositor picks the first panel registered. ## JavaScript Engine (SpiderMonkey) From 73dc2cbaa5e8d82fb5697aca4be9aead2cf6d95a Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 20:21:26 +0000 Subject: [PATCH 2/4] fix(shells): report the Super keys to pages as Meta winit names the Super keys NamedKey::Super, which the key conversion did not map, so pages saw an Unidentified key. The DOM names these keys Meta. --- crates/weft-app-shell/src/keyutils.rs | 3 ++- crates/weft-servo-shell/src/keyutils.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/weft-app-shell/src/keyutils.rs b/crates/weft-app-shell/src/keyutils.rs index 1665cb5..ba4bdf5 100644 --- a/crates/weft-app-shell/src/keyutils.rs +++ b/crates/weft-app-shell/src/keyutils.rs @@ -57,7 +57,8 @@ fn named_key(n: NamedKey) -> servo::NamedKey { NamedKey::Control => S::Control, NamedKey::Fn => S::Fn, NamedKey::FnLock => S::FnLock, - NamedKey::Meta => S::Meta, + // winit names the Super keys Super; the DOM names them Meta. + NamedKey::Meta | NamedKey::Super => S::Meta, NamedKey::NumLock => S::NumLock, NamedKey::ScrollLock => S::ScrollLock, NamedKey::Shift => S::Shift, diff --git a/crates/weft-servo-shell/src/keyutils.rs b/crates/weft-servo-shell/src/keyutils.rs index 1665cb5..ba4bdf5 100644 --- a/crates/weft-servo-shell/src/keyutils.rs +++ b/crates/weft-servo-shell/src/keyutils.rs @@ -57,7 +57,8 @@ fn named_key(n: NamedKey) -> servo::NamedKey { NamedKey::Control => S::Control, NamedKey::Fn => S::Fn, NamedKey::FnLock => S::FnLock, - NamedKey::Meta => S::Meta, + // winit names the Super keys Super; the DOM names them Meta. + NamedKey::Meta | NamedKey::Super => S::Meta, NamedKey::NumLock => S::NumLock, NamedKey::ScrollLock => S::ScrollLock, NamedKey::Shift => S::Shift, From e83c3f6df07026a6831440b24a6955d0f781f9a9 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 20:21:26 +0000 Subject: [PATCH 3/4] fix(appd): list installed apps in name order The catalog followed the store's directory listing, so the launcher's order, and with it its keyboard order, could change between scans. Apps are listed by name, ignoring case, then by ID. --- crates/weft-appd/src/main.rs | 46 ++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/crates/weft-appd/src/main.rs b/crates/weft-appd/src/main.rs index d3e716f..693b9ee 100644 --- a/crates/weft-appd/src/main.rs +++ b/crates/weft-appd/src/main.rs @@ -766,6 +766,9 @@ fn scan_installed_apps() -> Vec { } } } + // A stable order, so the launcher's keyboard order does not follow the + // directory listing. + apps.sort_by_cached_key(|app| (app.name.to_lowercase(), app.app_id.clone())); apps } @@ -1191,23 +1194,42 @@ mod tests { let _env = env_lock().blocking_lock(); let store = std::env::temp_dir().join(format!("weft_appd_scan_{}", std::process::id())); - let app_dir = store.join("com.example.scanner"); - fs::create_dir_all(&app_dir).unwrap(); - fs::write( - app_dir.join("wapp.toml"), - "[package]\nid = \"com.example.scanner\"\nname = \"Scanner\"\nversion = \"1.0.0\"\n\ - [runtime]\nmodule = \"app.wasm\"\n[ui]\nentry = \"ui/index.html\"\n", - ) - .unwrap(); + // Listed by name, ignoring case, then by ID, whatever the directory + // order. + for (id, name) in [ + ("com.example.scanner", "Scanner"), + ("com.example.zeta", "alpha"), + ("com.example.second", "Alpha"), + ("com.example.first", "Alpha"), + ] { + let app_dir = store.join(id); + fs::create_dir_all(&app_dir).unwrap(); + fs::write( + app_dir.join("wapp.toml"), + format!( + "[package]\nid = \"{id}\"\nname = \"{name}\"\nversion = \"1.0.0\"\n\ + [runtime]\nmodule = \"app.wasm\"\n[ui]\nentry = \"ui/index.html\"\n" + ), + ) + .unwrap(); + } let prior = std::env::var("WEFT_APP_STORE").ok(); unsafe { std::env::set_var("WEFT_APP_STORE", &store) }; let apps = scan_installed_apps(); - assert_eq!(apps.len(), 1); - assert_eq!(apps[0].app_id, "com.example.scanner"); - assert_eq!(apps[0].name, "Scanner"); - assert_eq!(apps[0].version, "1.0.0"); + let ids: Vec<&str> = apps.iter().map(|a| a.app_id.as_str()).collect(); + assert_eq!( + ids, + [ + "com.example.first", + "com.example.second", + "com.example.zeta", + "com.example.scanner" + ] + ); + assert_eq!(apps[3].name, "Scanner"); + assert_eq!(apps[3].version, "1.0.0"); unsafe { match prior { From fda9a7c22f5a8801a2b5618129114549bf33b4d0 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 20:21:26 +0000 Subject: [PATCH 4/4] fix(shell): make the system UI operable from the keyboard The launcher button, app icons and taskbar entries were custom elements with click handlers only: none could be focused, named or activated from the keyboard, and the launcher overlay neither took nor returned focus. They are now buttons with accessible names and a visible focus ring. The launcher is a modal dialog that a Super tap or the Apps button opens with focus on its first app; Tab moves between apps, Enter opens one and Escape or another Super tap closes it, returning focus to the Apps button. Each taskbar entry has an activate and a close button reachable with Tab, and focus moves to a remaining control when an entry closes or goes away. Notifications, including the offer to force quit, are announced as status. Servo does not tell the document when its window loses keyboard focus, so weft-servo-shell calls window.weftShellBlurred() then and the launcher closes; the next Super tap opens it again. Servo does not evaluate prefers-reduced-motion either, so the page has no transitions. tests/frame/check_system_ui.py drives the real page on the nested desktop with keys: opening apps from the launcher, reaching the shell with a Super tap from an application, a Super chord that stays with the app and leaves no Super modifier held there, activating and closing apps from the taskbar, the launcher closing when the shell loses focus, and toggling it. It fails without the compositor's Super handling or the focus-loss call. --- crates/weft-servo-shell/src/embedder.rs | 31 ++- docs/architecture.md | 4 +- docs/building.md | 1 + infra/shell/system-ui.html | 188 ++++++++++++---- tests/frame/check_system_ui.py | 281 ++++++++++++++++++++++++ 5 files changed, 452 insertions(+), 53 deletions(-) create mode 100644 tests/frame/check_system_ui.py diff --git a/crates/weft-servo-shell/src/embedder.rs b/crates/weft-servo-shell/src/embedder.rs index ffc5ab1..60026fe 100644 --- a/crates/weft-servo-shell/src/embedder.rs +++ b/crates/weft-servo-shell/src/embedder.rs @@ -296,12 +296,25 @@ impl App { self.next_endpoint_check, )); self.endpoint = appd_endpoint(self.ws_port); - let (Some(endpoint), Some(webview)) = (&self.endpoint, &self.webview) else { + let Some(endpoint) = &self.endpoint else { + return; + }; + // The credential goes only to the system UI document. + let call = format!( + "window.weftAppdEndpoint({}, '{}')", + endpoint.port, endpoint.token + ); + self.call_system_ui("weftAppdEndpoint", &call); + } + + /// Runs `call` in the system UI document if it defines the function + /// `name`. Navigation away from the document is denied; the script + /// checks the document again because a load can still be under way when + /// it runs. + fn call_system_ui(&self, name: &str, call: &str) { + let Some(webview) = &self.webview else { return; }; - // The credential goes only to the system UI document. Navigation away - // from it is denied; the script checks the document again because a - // load can still be under way when it runs. if !webview .url() .is_some_and(|url| same_document(url.as_str(), self.url.as_str())) @@ -313,9 +326,8 @@ impl App { format!( "window === window.top && \ location.href.split('#')[0] === {document} && \ - typeof window.weftAppdEndpoint === 'function' && \ - window.weftAppdEndpoint({}, '{}')", - endpoint.port, endpoint.token + typeof window.{name} === 'function' && \ + {call}" ), |_| {}, ); @@ -494,6 +506,11 @@ impl ApplicationHandler for App { WindowEvent::ModifiersChanged(mods) => { self.modifiers = mods.state(); } + // Servo does not tell the page when its window loses keyboard + // focus; the system UI closes its launcher then. + WindowEvent::Focused(false) => { + self.call_system_ui("weftShellBlurred", "window.weftShellBlurred()"); + } WindowEvent::KeyboardInput { event, .. } => { if let Some(wv) = &self.webview { let ev = super::keyutils::keyboard_event_from_winit(&event, self.modifiers); diff --git a/docs/architecture.md b/docs/architecture.md index 1207cd4..9aa77f3 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -8,11 +8,11 @@ WEFT OS is a Wayland compositor and application runtime where every app is a Web ### weft-compositor -Smithay-based Wayland compositor. Implements the `zweft-shell-unstable-v1` protocol extension, which allows shell clients (servo-shell, app-shell) to register their surfaces as typed shell slots. Each application session's Wayland connection is handed to the compositor by weft-appd, which binds the client to that session (see `security.md`). The compositor owns stacking and focus: the system shell's panel is sized to the output and starts beneath application windows, and clicking it brings it to the front as the shell's home, with its launcher, until an application is activated or opens its first window; layout changes keep the stacking order, and a window that maps without taking focus goes beneath the window in front; a session's first window, a clicked window and an activated one are raised, marked activated and given keyboard focus, and when the focused window closes the topmost remaining application window gets focus. Alt+F4 is the compositor's: it asks the focused application window to close (never the panel), and the app shell then exits and its session ends. A session's later windows are shown without taking focus. The panel reserves a strip along an output edge for the taskbar with `set_exclusive_zone` (weft-servo-shell reserves 48 logical pixels at the bottom), and the compositor lays every application window out to fill the remaining work area. weft-appd's `ACTIVATE_APP` request, which the taskbar sends, asks the compositor to activate a running session's window. Supports DRM/KMS and winit (software/dev) backends. +Smithay-based Wayland compositor. Implements the `zweft-shell-unstable-v1` protocol extension, which allows shell clients (servo-shell, app-shell) to register their surfaces as typed shell slots. Each application session's Wayland connection is handed to the compositor by weft-appd, which binds the client to that session (see `security.md`). The compositor owns stacking and focus: the system shell's panel is sized to the output and starts beneath application windows, and clicking it brings it to the front as the shell's home, with its launcher, until an application is activated or opens its first window; layout changes keep the stacking order, and a window that maps without taking focus goes beneath the window in front; a session's first window, a clicked window and an activated one are raised, marked activated and given keyboard focus, and when the focused window closes the topmost remaining application window gets focus. Alt+F4 is the compositor's: it asks the focused application window to close (never the panel), and the app shell then exits and its session ends. The Super keys are the compositor's too and never reach an application: a Super tap, pressed and released without another key or a pointer button, brings the panel (the first registered) to the front with keyboard focus and then delivers the tap to it, so the shell's launcher is reachable from any application; keys pressed while Super is held reach the focused window with the Super modifier, but Super's own key events do not. A session's later windows are shown without taking focus. The panel reserves a strip along an output edge for the taskbar with `set_exclusive_zone` (weft-servo-shell reserves 48 logical pixels at the bottom), and the compositor lays every application window out to fill the remaining work area. weft-appd's `ACTIVATE_APP` request, which the taskbar sends, asks the compositor to activate a running session's window. Supports DRM/KMS and winit (software/dev) backends. ### weft-servo-shell -System UI host. Renders one WebView pointing at `system-ui.html` using the embedded Servo engine (feature-gated behind `servo-embed`). Connects to the compositor as window type `panel`. Dispatches the `zweft_shell_manager_v1` event queue each frame. Forwards navigation gestures received from the compositor to `weft-appd` over WebSocket. Reads the appd WebSocket port and system token from `$XDG_RUNTIME_DIR/weft/` and hands both to the page through `window.weftAppdEndpoint(port, token)`; the shell hands the token only to the system UI document and denies top-level navigation away from it, and the launcher shows package names as text, never markup. +System UI host. Renders one WebView pointing at `system-ui.html` using the embedded Servo engine (feature-gated behind `servo-embed`). Connects to the compositor as window type `panel`. Dispatches the `zweft_shell_manager_v1` event queue each frame. Forwards navigation gestures received from the compositor to `weft-appd` over WebSocket. Reads the appd WebSocket port and system token from `$XDG_RUNTIME_DIR/weft/` and hands both to the page through `window.weftAppdEndpoint(port, token)`; the shell hands the token only to the system UI document and denies top-level navigation away from it, and the launcher shows package names as text, never markup. The system UI works from the keyboard: a Super tap opens or closes the launcher, which lists installed apps by name and keeps focus while open (Tab moves between apps, Enter opens one, Escape closes it and returns focus to the Apps button, with the shell's home still in front); every taskbar entry and its close button is a button reachable with Tab, and Enter on an entry brings its app back. The shell tells the page through `window.weftShellBlurred()` when it loses keyboard focus, which Servo does not report to the document, and the launcher closes. The page has no transitions or animations, since Servo does not evaluate `prefers-reduced-motion`. ### weft-app-shell diff --git a/docs/building.md b/docs/building.md index 9ca5f22..981c5ee 100644 --- a/docs/building.md +++ b/docs/building.md @@ -89,6 +89,7 @@ python3 tests/frame/check_notes.py # Notes stores exactly what is typed, ref python3 tests/frame/check_app_data.py # Notes data from the earlier layout is moved and kept python3 tests/frame/check_confinement.py # an app page reaches only its UI files and its session bridge python3 tests/frame/check_activation.py # apps fill the work area above the taskbar; launch and ACTIVATE_APP raise and focus +python3 tests/frame/check_system_ui.py # the system UI's launcher and taskbar work from the keyboard alone, reached with a Super tap ``` ## Demo apps (wasm32-wasip2) diff --git a/infra/shell/system-ui.html b/infra/shell/system-ui.html index 4d0b5eb..2d49b94 100644 --- a/infra/shell/system-ui.html +++ b/infra/shell/system-ui.html @@ -14,6 +14,7 @@ --text-primary: rgba(255, 255, 255, 0.92); --text-secondary: rgba(255, 255, 255, 0.55); --accent: #5b8af5; + --focus-ring: #9db8ff; } *, *::before, *::after { @@ -63,19 +64,30 @@ -webkit-backdrop-filter: blur(20px); } - weft-taskbar-launcher { + button { + font: inherit; + color: inherit; + border: 0; + margin: 0; + background: transparent; + cursor: pointer; + } + + :focus-visible { + outline: 2px solid var(--focus-ring); + outline-offset: 2px; + } + + #launcher-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; - cursor: pointer; - background: transparent; - transition: background 0.15s; } - weft-taskbar-launcher:hover { + #launcher-btn:hover { background: var(--surface-border); } @@ -111,55 +123,56 @@ margin: 0 auto; } - weft-app-icon { + .app-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 12px; - cursor: pointer; color: var(--text-primary); font-size: 12px; text-align: center; word-break: break-word; - transition: background 0.15s; } - weft-app-icon:hover { + .app-icon:hover { background: var(--surface-border); } - weft-app-icon svg { + .app-icon svg { flex-shrink: 0; } weft-taskbar-app { display: inline-flex; align-items: center; - gap: 4px; + gap: 2px; font-size: 12px; color: var(--text-secondary); - padding: 0 4px 0 6px; - cursor: pointer; border-radius: 6px; - transition: background 0.15s; } weft-taskbar-app:hover { background: var(--surface-border); } + weft-taskbar-app .task-activate { + padding: 4px 2px 4px 6px; + border-radius: 6px; + } + weft-taskbar-app .task-close { opacity: 0; font-size: 11px; line-height: 1; - padding: 1px 3px; + padding: 3px 4px; border-radius: 3px; - transition: opacity 0.1s, background 0.1s; } - weft-taskbar-app:hover .task-close { + /* Shown on hover and whenever the entry has keyboard focus. */ + weft-taskbar-app:hover .task-close, + weft-taskbar-app:focus-within .task-close { opacity: 1; } @@ -167,6 +180,10 @@ background: rgba(255,80,80,0.3); } + weft-taskbar-app .task-close.force { + color: #ff6b6b; + } + weft-notification-center { position: fixed; top: 8px; @@ -188,7 +205,8 @@ - + -