From df528150802898d89bf04185eab753ac4687b02c Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Tue, 10 Nov 2026 21:25:31 -0600 Subject: [PATCH 1/3] omamobile-shell: add browser history after native Back handlers Build browser Back on current main BackLink handling. Preserve keyboard-first, terminal Home and Escape keymap behavior. Register quick settings, drawer and recents in the existing active registry so browser navigation cannot pass underneath them. Choose history from coherent activated browser handles captured at gesture start. Share the packaged reader URL from personal clones. Exercise actual routing/native callbacks and keep the existing surface, haptic and model fixtures current. Full current-main package and attended qualification remain pending. Co-Authored-By: Codex --- docs/TOUCH-PLAN.md | 51 +++++++ packages/omamobile-shell/plugins/README.md | 8 ++ .../plugins/omamobile.back/Back.qml | 34 +++-- .../plugins/omamobile.back/BackLinkClient.qml | 4 + .../plugins/omamobile.back/BackModel.js | 16 ++- .../plugins/omamobile.launcher/Launcher.qml | 17 +++ .../omamobile.quicksettings/QuickSettings.qml | 30 ++++ .../plugins/omamobile.switcher/Switcher.qml | 18 +++ packages/omamobile-shell/test/all | 21 ++- packages/omamobile-shell/test/back-clone.py | 67 +++++++++ packages/omamobile-shell/test/back-haptic.py | 4 +- packages/omamobile-shell/test/back-model.js | 38 +++++ .../omamobile-shell/test/back-navigation.py | 134 ++++++++++++++++++ .../omamobile-shell/test/back-surfaces.py | 22 ++- 14 files changed, 447 insertions(+), 17 deletions(-) create mode 100644 packages/omamobile-shell/test/back-clone.py create mode 100644 packages/omamobile-shell/test/back-navigation.py diff --git a/docs/TOUCH-PLAN.md b/docs/TOUCH-PLAN.md index 38ad3136e..eed498dda 100644 --- a/docs/TOUCH-PLAN.md +++ b/docs/TOUCH-PLAN.md @@ -96,6 +96,57 @@ Hyprland transform 1 or 3 gives a 1040x480 logical px output (portrait is 480x10 **What remains after batch 4:** 1.11 (gum prompts as sheets: onboarding, PIN setup), 1.12's Nightlight and Reminder tiles, 2.1's per-token font seeds (the 12 px floor is in; the overrides need a theme-change check), 2.7 contrast (4.5:1 for placeholder and secondary text), 3.1 per-site web-app flags, 3.3's upstreamable `menu.d` patch (the rows are hidden by `omamobile-setup-user` for now), 3.6 haptics, 3.7 polish, and the Omarchy patches 3-6 below. +## Browser history after native Back, 2026-11-11 (1.2) + +Build on #643's native BackLink registry, keyboard-first behavior, Escape via +wtype and terminal-Home handling. After native handlers decline Back, both +edges navigate Chrome/Chromium history. Require an activated, non-modal known +browser and matching Wayland/Hyprland handles, unchanged since gesture start. +Browser Back sends `wtype -M alt -k Left -m alt`; only without wtype does it +use the ordered ALT/code:113 dispatch pair. At the first browser page, Back +stays on that page; the home pill goes home. +Missing canonical reader, unknown app or changed focus uses the existing main +fallback. An empty active-handler list has its upstream meaning: no surface +consumed Back. No all-plugin readiness requirement is imposed. + +Quick settings, drawer and recents join that same registry. Wi-Fi/Bluetooth +cancel their nested sheets before returning to quick settings; recorder emits +its existing back request; editing/search/recents menus go back one level. +The packaged BackLinkClient URL is shared by personal clones and publishers. +Preserve threshold haptics and upstream Home/Escape argv and package version. + +Earlier 6a candidates established browser Back from both physical edges and +with the keyboard open, but preceded #643's keyboard-first contract. A native +Qt dialog exposed fixed code:9 translating to Qt key0 with Squeekboard's map; +wtype delivered Qt Escape16777216 and closed it. The reviewed local Escape +correction passed physical dialog checks with keyboard hidden and visible, +and normal typing afterward. That Escape mechanism is now supplied by main. +These observations do not qualify this new integration's native ordering. + +Userspace runbook (low risk): + +1. Run policy, complete shell suite, current native-surface/routing/model and + clone tests. Build the complete combined browser/gesture package. Stop on + any failure. Back up the installed package and current profile/clone, + browser flags and done markers for rollback. +2. Announce installation and cold shell restart. Verify the session is + unlocked immediately before each, install the complete package and restart + the shell. Stop on QML errors or changed personal settings. Keep the + existing qualified kernel and boot-update policy for this userspace trial. +3. With two browser pages, test both edges with keyboard hidden. Raise and + type into the keyboard: first Back hides it without navigating, next Back + navigates. Check native quick settings/Wi-Fi/Bluetooth/recorder, drawer and + recents; Back must not navigate the browser beneath them. Test actual Qt + dialog and prompt cancellation, focus changes and lock/unlock. Stop if a + key reaches the wrong surface or a modifier remains held. +4. Measure physical release-to-frame latency. The removed helper's 247ms + measurement is not a result for this route. Maintainer Pixel 7 Pro and + other reference-phone checks remain before merge. Keep draft until those + qualification checks are recorded. +5. Rollback by reinstalling the saved package, restoring only changed user + files from the private backup and restarting while unlocked. Recheck the + personal clock, browser flags/zoom and selected Back plugin. + ## Suggested order 1. Phase 0 (one `omamobile-omarchy` and firstboot release, plus a `phone-smoke` lock check). diff --git a/packages/omamobile-shell/plugins/README.md b/packages/omamobile-shell/plugins/README.md index 6209a381d..8ed05472a 100644 --- a/packages/omamobile-shell/plugins/README.md +++ b/packages/omamobile-shell/plugins/README.md @@ -1205,3 +1205,11 @@ What upstream needs instead, smallest first: `omarchy.notifications` only to full bars. Quick settings calls the `notifications` IPC target on its own shell instance (`qs ipc -p Quickshell.shellDir`) instead. + +Browser history follows the native Back handlers. Both edges use Alt+Left for +an activated Chrome/Chromium window whose current Wayland and Hyprland handles +agree with the window captured at gesture start. Modal, changed or uncertain +focus uses the existing Escape/Home path. Quick settings, drawer and recents +register active handlers with BackLink so navigation stays in their topmost +surface. A cloned Back plugin reads through the packaged BackLinkClient URL, +sharing the same registry as native publishers. diff --git a/packages/omamobile-shell/plugins/omamobile.back/Back.qml b/packages/omamobile-shell/plugins/omamobile.back/Back.qml index ddb68fcc4..5ee5747e7 100644 --- a/packages/omamobile-shell/plugins/omamobile.back/Back.qml +++ b/packages/omamobile-shell/plugins/omamobile.back/Back.qml @@ -6,13 +6,13 @@ import Quickshell.Wayland import qs.Commons import qs.Commons as Commons import "BackModel.js" as BackModel -import "BackLink.js" as BackLink // The back gesture, as on Android (TOUCH-PLAN 1.2): swipe in from the left // or right edge of the screen and let go to go back. "Back" is Escape, sent // to whatever has the keyboard focus (BackModel.js has how): it closes app // dialogs, menus and popovers that have no other way out on a touch screen, -// and the shell's own sheets and drawer, which all close on Escape. An app +// and the shell's own sheets and drawer. After native handling, an activated +// Chrome/Chromium window goes back in browser history from either edge. An app // goes back one level on it, and at its top level asks for the home screen // (omamobile-home), as Back at an app's first screen does on Android. // @@ -39,17 +39,32 @@ Item { } function close() {} + // Use the packaged URL from personal clones as well as the packaged plugin. + Loader { + id: backLink + source: Qt.resolvedUrl("../omamobile.back/BackLinkClient.qml") + } + // `shell call omamobile.back back ''`: the same as the gesture. One Back // does one thing (BackLink.js): the on-screen keyboard is put away, or // else the topmost shell surface that registered closes, or else Escape - // goes to the focused window. Returns what used it. - function back() { - var used = BackLink.back() + // goes to the focused window, with history Back for a coherent browser. + // Returns what used it. + function back(payloadJson, startedToplevel) { + var client = backLink.item + var ready = !!client && typeof client.back === "function" + var used = ready ? client.back() : "" if (used !== "") { console.log("omamobile-back:", used) return used } - Quickshell.execDetached(BackModel.ESCAPE_ARGV) + var active = ToplevelManager.activeToplevel + var started = startedToplevel === undefined ? active : startedToplevel + var hypr = Hyprland.activeToplevel + var browser = ready && !!active && active === started + && active.activated === true && !active.parent + && !!hypr && hypr.wayland === active && BackModel.isBrowser(active.appId) + Quickshell.execDetached(browser ? BackModel.BROWSER_BACK_ARGV : BackModel.ESCAPE_ARGV) return "ok" } @@ -68,7 +83,7 @@ Item { // `shell call omamobile.back state ''` function state() { return JSON.stringify({ fullscreen: fullscreenOnScreen, strips: !fullscreenOnScreen, edge: edge, threshold: BackModel.THRESHOLD, - asks: BackLink.names() }) + asks: backLink.item ? backLink.item.names() : [] }) } // The touchable strip at each edge, and the width its window draws in. @@ -170,6 +185,7 @@ Item { readonly property bool armed: BackModel.fires(inward, across, BackModel.THRESHOLD) property real atY: 0 property bool wasArmed: false + property var startedToplevel: null onCentroidChanged: if (active) atY = centroid.position.y // One threshold tick per gesture, even if the finger crosses back. property bool feedbackSent: false @@ -182,9 +198,9 @@ Item { } } onActiveChanged: { - if (active) { atY = centroid.position.y; wasArmed = false; feedbackSent = false; return } + if (active) { startedToplevel = ToplevelManager.activeToplevel; atY = centroid.position.y; wasArmed = false; feedbackSent = false; return } console.log("omamobile-back: swipe", win.rightEdge ? "right" : "left", wasArmed ? "back" : "") - if (wasArmed) root.back() + if (wasArmed) root.back("", startedToplevel) } } } diff --git a/packages/omamobile-shell/plugins/omamobile.back/BackLinkClient.qml b/packages/omamobile-shell/plugins/omamobile.back/BackLinkClient.qml index 0de1fc3d0..faae5e124 100644 --- a/packages/omamobile-shell/plugins/omamobile.back/BackLinkClient.qml +++ b/packages/omamobile-shell/plugins/omamobile.back/BackLinkClient.qml @@ -22,6 +22,10 @@ import "BackLink.js" as BackLink Item { id: client + // A reader uses this same packaged URL to share publishers from clones. + function back() { return BackLink.back() } + function names() { return BackLink.names() } + property bool active: false property var handler: null property string tier: "surface" diff --git a/packages/omamobile-shell/plugins/omamobile.back/BackModel.js b/packages/omamobile-shell/plugins/omamobile.back/BackModel.js index 2fc787fa0..2f32e0d43 100644 --- a/packages/omamobile-shell/plugins/omamobile.back/BackModel.js +++ b/packages/omamobile-shell/plugins/omamobile.back/BackModel.js @@ -47,6 +47,20 @@ var ESCAPE_ARGV = ["sh", "-c", // asks. `shell call omamobile.back home ''` runs it too. var HOME_ARGV = ["omamobile-home"] +// Browser history is chosen in QML after native Back handlers. Use the same +// virtual keyboard as Escape; retain the ordered dispatch pair as fallback. +var BROWSER_BACK_ARGV = ["sh", "-c", + 'if command -v wtype >/dev/null 2>&1; then exec wtype -M alt -k Left -m alt; fi; ' + + 'hyprctl dispatch "$1" >/dev/null; sleep 0.05; hyprctl dispatch "$2" >/dev/null', "sh", + 'hl.dsp.send_key_state({ mods = "ALT", key = "code:113", state = "down" })', + 'hl.dsp.send_key_state({ mods = "ALT", key = "code:113", state = "up" })'] + +function isBrowser(appId) { + var id = String(appId || "") + return ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "org.chromium.Chromium", "com.google.Chrome"].indexOf(id) !== -1 + || /^chrome-.+-(?:Default|Profile(?:_\d+)?)$/.test(id) +} + // How far the finger has to come in from the edge (logical px), and how far // a swipe may wander along the edge for each pixel it comes in: a mostly // vertical drag that starts on the strip is not a back. @@ -73,7 +87,7 @@ function inwardFor(rightEdge, translationX) { } if (typeof module !== "undefined") { - module.exports = { TERMINALS: TERMINALS, isTerminal: isTerminal, + module.exports = { BROWSER_BACK_ARGV: BROWSER_BACK_ARGV, isBrowser: isBrowser, TERMINALS: TERMINALS, isTerminal: isTerminal, ESCAPE_DOWN: ESCAPE_DOWN, ESCAPE_UP: ESCAPE_UP, ESCAPE_ARGV: ESCAPE_ARGV, HOME_ARGV: HOME_ARGV, THRESHOLD: THRESHOLD, progress: progress, fires: fires, inwardFor: inwardFor } diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml b/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml index 8ccbb3505..a1685085c 100644 --- a/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml +++ b/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml @@ -51,6 +51,23 @@ Item { // `opened` is the drawer; the dock is always on screen. property bool opened: false + + Loader { + source: Qt.resolvedUrl("../omamobile.back/BackLinkClient.qml") + onLoaded: { + item.name = "app drawer" + item.handler = function() { return root.navigationBack() } + item.active = Qt.binding(function() { return root.opened }) + } + } + + function navigationBack() { + if (!opened) return false + if (input.activeFocus && query) query = "" + else dismiss(0) + return true + } + property string query: "" property var apps: [] property int appsRevision: 0 diff --git a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml index 46c1d6757..4bfdee127 100644 --- a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml +++ b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml @@ -52,6 +52,36 @@ Item { property var manifest: null property bool opened: false + + Loader { + source: Qt.resolvedUrl("../omamobile.back/BackLinkClient.qml") + onLoaded: { + item.name = "quick settings" + item.handler = function() { return root.navigationBack() } + item.active = Qt.binding(function() { return root.navigationOpen }) + } + } + + readonly property bool navigationOpen: opened || wifiPicker.opened || bluetoothPanelItem.opened || recordPanelItem.opened + + function navigationBack() { + if (wifiPicker.opened) { + if (wifiPicker.sheet) wifiPicker.cancelSheet() + else wifiPicker.backRequested() + return true + } + if (bluetoothPanelItem.opened) { + if (bluetoothPanelItem.activeSheet) bluetoothPanelItem.cancelSheet() + else bluetoothPanelItem.backRequested() + return true + } + if (recordPanelItem.opened) { recordPanelItem.backRequested(); return true } + if (!opened) return false + if (editing) finishEditing() + else dismiss() + return true + } + readonly property string pluginId: (manifest && manifest.id) || "omamobile.quicksettings" // ---------------------------------------------------------------- lifecycle diff --git a/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml b/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml index 7a48e2565..293f8f3da 100644 --- a/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml +++ b/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml @@ -42,6 +42,24 @@ Item { property bool opened: false + Loader { + source: Qt.resolvedUrl("../omamobile.back/BackLinkClient.qml") + onLoaded: { + item.name = "recent apps" + item.handler = function() { return root.navigationBack() } + item.active = Qt.binding(function() { return root.opened }) + } + } + + function navigationBack() { + if (!opened) return false + if (actionsOpen && actionPage === "pick") actionPage = "menu" + else if (actionsOpen) closeActions() + else dismiss() + return true + } + + // Newest first, like Android's recents. readonly property var windows: { var list = ToplevelManager.toplevels.values.slice() diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 85affa2b1..4b7bff7f2 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -97,7 +97,7 @@ for sc in 3 '8 \/ 3'; do t=$(printf 'local omarchy_monitor_scale = 2\n' | sed "s/^local omarchy_monitor_scale = .*/local omarchy_monitor_scale = $sc/") [[ $t == 'local omarchy_monitor_scale = 3' || $t == 'local omarchy_monitor_scale = 8 / 3' ]] || fail "the seeded scale line ($t)" done -grep -c 'Quickshell.execDetached(BackModel.ESCAPE_ARGV)' "$b" >/dev/null || fail "back sends Escape through BackModel" +grep -c 'Quickshell.execDetached(browser ? BackModel.BROWSER_BACK_ARGV : BackModel.ESCAPE_ARGV)' "$b" >/dev/null || fail "back sends Escape through BackModel" grep -c 'WlrLayershell.namespace: "omamobile-back"' "$b" >/dev/null || fail "back strips' namespace" grep -c 'mask: Region { item: strip }' "$b" >/dev/null || fail "only the edge strip takes touches" grep -c 'exclusionMode: ExclusionMode.Normal' "$b" >/dev/null || fail "back strips stay clear of the bar and the keyboard" @@ -119,8 +119,10 @@ grep -c 'Quickshell.execDetached(BackModel.HOME_ARGV)' "$b" >/dev/null || fail " # list's rules and test/back-surfaces.py every surface's registration. head -3 plugins/omamobile.back/BackLink.js | grep -c '^\.pragma library$' >/dev/null || fail "BackLink.js is one instance per engine (.pragma library)" grep -c '^import "BackLink.js" as BackLink$' plugins/omamobile.back/BackLinkClient.qml >/dev/null || fail "BackLinkClient.qml imports BackLink.js beside it" -grep -c '^import "BackLink.js" as BackLink$' "$b" >/dev/null || fail "Back.qml imports the same BackLink.js" -grep -c 'var used = BackLink.back()' "$b" >/dev/null || fail "back asks BackLink before sending Escape" +# The reader loads the canonical client too: a personal clone must share the +# publishers' registry rather than importing its own copied BackLink.js. +grep -c 'source: Qt.resolvedUrl("../omamobile.back/BackLinkClient.qml")' "$b" >/dev/null || fail "Back.qml loads the canonical BackLink client" +grep -c 'var used = ready ? client.back() : ""' "$b" >/dev/null || fail "back asks BackLink before sending Escape" # The keyboard is hidden through squeekboard's own call, never by turning it # off (the screen-keyboard-enabled setting; AGENTS.md, Userspace). k=plugins/omamobile.keyboard/Keyboard.qml @@ -1256,3 +1258,16 @@ else pass "Back threshold feedback: once per gesture, both edges and retreat" fi bash test/power-overlap.sh || fail "overlapping power-key presses" + +# Browser routing runs Back.qml's handler and native callbacks with dispatch +# recorded. The clone probe loads the exact canonical reader URL. +for test in back-navigation.py back-clone.py; do + rc=0; out=$(python3 -B "test/$test" 2>&1) || rc=$? + if [[ $rc == 77 ]]; then + pass "$test # SKIP no qmltestrunner" + elif [[ $rc != 0 ]]; then + printf '%s\n' "$out" >&2; fail "$test" + else + pass "$test" + fi +done diff --git a/packages/omamobile-shell/test/back-clone.py b/packages/omamobile-shell/test/back-clone.py new file mode 100644 index 000000000..9ddf25ec1 --- /dev/null +++ b/packages/omamobile-shell/test/back-clone.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Qt clone-registry probe using the exact candidate Back.qml client Loader.""" +import argparse +import os +from pathlib import Path +import shutil +import subprocess +import tempfile + +parser = argparse.ArgumentParser() +parser.add_argument('package', type=Path, nargs='?', default=Path(__file__).resolve().parents[1]) +parser.add_argument('--negative', action='store_true') +args = parser.parse_args() +src = args.package / 'plugins/omamobile.back' +source = (src / 'Back.qml').read_text() +client_id = source.index('id: backLink') +start = source.rindex('Loader {', 0, client_id) +depth = 0 +for end in range(source.index('{', start), len(source)): + depth += (source[end] == '{') - (source[end] == '}') + if depth == 0: + loader = source[start:end + 1] + break +else: + raise AssertionError('unterminated Loader') +if args.negative: + loader = loader.replace('../omamobile.back/BackLinkClient.qml', 'BackLinkClient.qml') +runner = shutil.which('qmltestrunner6') or shutil.which('/usr/lib/qt6/bin/qmltestrunner') +if not runner: + raise SystemExit(77) +with tempfile.TemporaryDirectory(prefix='back-clone-') as tmp: + directory = Path(tmp) + for name in ('omamobile.back', 'personal.back', 'runtime'): + (directory / name).mkdir(mode=0o700) + # The personal directory has its own copy, just as plugin clone creates. + for name in ('omamobile.back', 'personal.back'): + for filename in ('BackLink.js', 'BackLinkClient.qml'): + shutil.copyfile(src / filename, directory / name / filename) + (directory / 'personal.back/Reader.qml').write_text('import QtQuick\nItem {\n' + loader + '\nfunction back() { return backLink.item ? backLink.item.back() : "unknown" }\n}\n') + (directory / 'tst_clone.qml').write_text('''import QtQuick +import QtTest +import "omamobile.back/BackLink.js" as Original +TestCase { + name:"FixedCloneRegistry"; when:windowShown + Loader { id:publisher; source:"omamobile.back/BackLinkClient.qml" } + Loader { id:reader; source:"personal.back/Reader.qml" } + function test_sameCanonicalClient() { + var hits=0 + publisher.item.name="panel" + publisher.item.handler=function(){hits++;return true} + publisher.item.active=true + compare(Original.names().join(","),"panel") + compare(reader.item.back(),"panel") + compare(hits,1) + publisher.item.active=false + compare(reader.item.back(),"") + } +} +''') + env = os.environ.copy() + env.update(QT_QPA_PLATFORM='offscreen', QT_QUICK_BACKEND='software', QT_QPA_PLATFORMTHEME='generic', XDG_RUNTIME_DIR=str(directory / 'runtime')) + env.pop('QT_PLUGIN_PATH', None) + env.pop('QT_QPA_GENERIC_PLUGINS', None) + result = subprocess.run([runner, '-input', str(directory / 'tst_clone.qml')], env=env, capture_output=True, text=True, timeout=10) + print(result.stdout + result.stderr, end='') + raise SystemExit(result.returncode) diff --git a/packages/omamobile-shell/test/back-haptic.py b/packages/omamobile-shell/test/back-haptic.py index 594c3eb1a..a11979953 100644 --- a/packages/omamobile-shell/test/back-haptic.py +++ b/packages/omamobile-shell/test/back-haptic.py @@ -28,7 +28,7 @@ def handler(name): raise AssertionError("unterminated handler") -h = {"armed": handler("onArmedChanged"), "active": handler("onActiveChanged")} +h = {"armed": handler("onArmedChanged"), "active": handler("onActiveChanged").replace("ToplevelManager.activeToplevel", "manager.activeToplevel")} if args.negative: h["armed"] = h["armed"].replace("armed && !feedbackSent", "armed") @@ -40,6 +40,7 @@ def handler(name): property int backs:0 function haptic(){ticks++} function back(){backs++} + QtObject {id:manager;property var activeToplevel:null} QtObject {id:win;property bool rightEdge:false} QtObject {id:centroid;property point position:Qt.point(0,20)} QtObject { @@ -48,6 +49,7 @@ def handler(name): property bool armed:false property bool wasArmed:false property bool feedbackSent:false + property var startedToplevel:null property real atY:0 onArmedChanged: ARMED onActiveChanged: ACTIVE diff --git a/packages/omamobile-shell/test/back-model.js b/packages/omamobile-shell/test/back-model.js index 975f7366b..bb59d7be6 100644 --- a/packages/omamobile-shell/test/back-model.js +++ b/packages/omamobile-shell/test/back-model.js @@ -58,6 +58,44 @@ test("a terminal gets no Escape: Back goes home; every other window gets the vir assert.ok(M.isTerminal("foot") && M.isTerminal("org.omarchy.terminal") && !M.isTerminal("") && !M.isTerminal("Foot")) }) +test("browser history uses the virtual keyboard with the ordered Alt+Left dispatch fallback", () => { + const [sh, c, script, name, down, up] = M.BROWSER_BACK_ARGV + assert.deepStrictEqual([sh, c, name], ["sh", "-c", "sh"]) + assert.strictEqual(down, 'hl.dsp.send_key_state({ mods = "ALT", key = "code:113", state = "down" })') + assert.strictEqual(up, down.replace('"down"', '"up"')) + assert.ok(script.indexOf("exec wtype -M alt -k Left -m alt") < script.indexOf('hyprctl dispatch "$1"')) + assert.ok(script.indexOf('hyprctl dispatch "$1"') < script.indexOf("sleep 0.05")) + assert.ok(script.indexOf("sleep 0.05") < script.indexOf('hyprctl dispatch "$2"')) +}) + +test("browser Back releases Alt and runs only the selected key path", () => { + const fs = require("fs"), os = require("os"), cp = require("child_process") + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "back-browser-")) + const log = path.join(dir, "log") + const stub = (name, body) => fs.writeFileSync(path.join(dir, name), "#!/bin/sh\n" + body + "\n", { mode: 0o755 }) + try { + const sleep = cp.execSync("command -v sleep", { shell: "/bin/sh" }).toString().trim() + fs.symlinkSync(sleep, path.join(dir, "sleep")) + stub("hyprctl", 'echo "hyprctl $*" >> "$LOG"') + stub("wtype", 'echo "wtype $*" >> "$LOG"') + const run = () => { + fs.writeFileSync(log, "") + cp.execFileSync("/bin/sh", M.BROWSER_BACK_ARGV.slice(1), { env: { PATH: dir, LOG: log } }) + return fs.readFileSync(log, "utf8").trim().split("\n") + } + assert.deepStrictEqual(run(), ["wtype -M alt -k Left -m alt"]) + fs.rmSync(path.join(dir, "wtype")) + assert.deepStrictEqual(run(), ["hyprctl dispatch " + M.BROWSER_BACK_ARGV[4], "hyprctl dispatch " + M.BROWSER_BACK_ARGV[5]]) + } finally { fs.rmSync(dir, { recursive: true, force: true }) } +}) + +test("browser matching includes installed apps without matching helpers or prompts", () => { + for (const id of ["google-chrome", "chromium", "chromium-browser", "chrome-mail.google.com__-Default", "chrome-abcdef-Profile_1"]) + assert.ok(M.isBrowser(id), id) + for (const id of [null, "", "foot", "polkit", "chrome-password-dialog", "chromium-prompt", "google-chrome-helper"]) + assert.ok(!M.isBrowser(id), id) +}) + test("home is the shell's one command, with nothing of Hyprland in it", () => { assert.deepStrictEqual(M.HOME_ARGV, ["omamobile-home"]) }) diff --git a/packages/omamobile-shell/test/back-navigation.py b/packages/omamobile-shell/test/back-navigation.py new file mode 100644 index 000000000..9c397b6e6 --- /dev/null +++ b/packages/omamobile-shell/test/back-navigation.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Run candidate routing and panel callbacks in Qt, with key injection stubbed.""" +import os +from pathlib import Path +import shutil +import subprocess +import tempfile + +pkg = Path(__file__).resolve().parents[1] + + +def function(path, name): + source = path.read_text() + start = source.index(" function " + name + "(") + brace = source.index("{", start) + depth = 0 + for end in range(brace, len(source)): + if source[end] == "{": + depth += 1 + elif source[end] == "}": + depth -= 1 + if depth == 0: + return source[start:end + 1] + raise AssertionError("unterminated function") + + +back = function(pkg / "plugins/omamobile.back/Back.qml", "back") +back = back.replace("ToplevelManager.activeToplevel", "manager.activeToplevel").replace("Hyprland.activeToplevel", "hyprSource.activeToplevel").replace("Quickshell.execDetached", "root.record") +quick = function(pkg / "plugins/omamobile.quicksettings/QuickSettings.qml", "navigationBack").replace("function navigationBack", "function quickBack") +drawer = function(pkg / "plugins/omamobile.launcher/Launcher.qml", "navigationBack").replace("function navigationBack", "function drawerBack") +recents = function(pkg / "plugins/omamobile.switcher/Switcher.qml", "navigationBack").replace("function navigationBack", "function recentsBack") +qml = r'''import QtQuick +import QtTest +import "BackLink.js" as BackLink +import "BackModel.js" as BackModel +TestCase { + id: root; name: "BrowserBackRouting"; when: windowShown + property var calls: [] + property bool opened: false + property bool editing: false + property string query: "" + property bool actionsOpen: false + property string actionPage: "" + property int dismissals: 0 + property int returns: 0 + Loader { id: backLink; source: Qt.resolvedUrl("../omamobile.back/BackLinkClient.qml") } + QtObject { id: manager; property var activeToplevel: null } + QtObject { id: hyprSource; property var activeToplevel: null } + QtObject { id: input; property bool activeFocus: false } + QtObject { id: wifiPicker; property bool opened: false; property string sheet: ""; function cancelSheet(){sheet=""} function backRequested(){opened=false; root.opened=true; root.returns++} } + QtObject { id: bluetoothPanelItem; property bool opened: false; property string activeSheet: ""; function cancelSheet(){activeSheet=""} function backRequested(){opened=false; root.opened=true; root.returns++} } + QtObject { id: recordPanelItem; property bool opened: false; function backRequested(){opened=false; root.opened=true; root.returns++} } + function record(argv) { calls.push(argv) } + function dismiss(speed) { opened=false; dismissals++ } + function finishEditing() { editing=false } + function closeActions() { actionsOpen=false } + BACK + QUICK + DRAWER + RECENTS + function browser() { var w={appId:"chromium",activated:true,parent:null}; manager.activeToplevel=w; hyprSource.activeToplevel={wayland:w}; return w } + function init() { + backLink.active=true; tryVerify(function(){return backLink.item!==null}) + BackLink.clear(); calls=[]; opened=false; editing=false; query=""; input.activeFocus=false; actionsOpen=false; actionPage=""; dismissals=0; returns=0 + wifiPicker.opened=false; wifiPicker.sheet=""; bluetoothPanelItem.opened=false; bluetoothPanelItem.activeSheet=""; recordPanelItem.opened=false; browser() + } + function history() { compare(calls.length,1); compare(JSON.stringify(calls[0]),JSON.stringify(BackModel.BROWSER_BACK_ARGV)) } + function fallback() { compare(calls.length,1); compare(JSON.stringify(calls[0]),JSON.stringify(BackModel.ESCAPE_ARGV)) } + function test_bothEdgesBack() { var w=browser(); back("left",w); history(); calls=[]; back("right",w); history() } + function test_changedAndUnknownFocus() { var w=browser(); browser(); back("",w); fallback(); calls=[]; manager.activeToplevel=null; back(); fallback() } + function test_modalAndInactiveBrowser() { manager.activeToplevel.parent={}; back(); fallback(); calls=[]; browser().activated=false; back(); fallback() } + function test_otherAppAndDisagreement() { manager.activeToplevel.appId="foot"; back(); fallback(); calls=[]; browser(); hyprSource.activeToplevel=null; back(); fallback() } + Window { id: shellWindow; visible:true; width:20; height:20 } + function test_staleApplicationActiveDoesNotBlockBrowser() { shellWindow.requestActivate(); tryCompare(Qt.application,"state",Qt.ApplicationActive); browser(); back(); history() } + function test_missingCanonicalReaderFallsBack() { backLink.active=false; tryVerify(function(){return backLink.item===null}); back(); fallback() } + function test_keyboardBeforePanelBeforeHistory() { + var keyboard={}, panel={}; var hidden=0,closed=0 + BackLink.register(panel,function(){closed++;BackLink.unregister(panel);return true},"surface","panel") + BackLink.register(keyboard,function(){hidden++;BackLink.unregister(keyboard);return true},"keyboard","keyboard") + compare(back(),"keyboard"); compare(hidden,1); compare(closed,0); compare(calls.length,0) + compare(back(),"panel"); compare(closed,1); compare(calls.length,0) + back(); history() + } + function test_quickSettingsNestedWifi() { + wifiPicker.opened=true; wifiPicker.sheet="password" + BackLink.register(root,root.quickBack,"surface","quick settings") + back(); compare(wifiPicker.sheet,""); verify(wifiPicker.opened); compare(calls.length,0) + back(); verify(!wifiPicker.opened); verify(opened); compare(returns,1) + back(); compare(dismissals,1); compare(calls.length,0) + } + function test_quickSettingsBluetoothRecordAndEditing() { + bluetoothPanelItem.opened=true; bluetoothPanelItem.activeSheet="confirm" + BackLink.register(root,root.quickBack,"surface","quick settings") + back(); compare(bluetoothPanelItem.activeSheet,""); back(); compare(returns,1) + opened=false; recordPanelItem.opened=true; back(); compare(returns,2) + editing=true; back(); verify(!editing); verify(opened); compare(calls.length,0) + } + function test_drawerSearchThenDismiss() { + opened=true; query="apps"; input.activeFocus=true + BackLink.register(root,root.drawerBack,"surface","app drawer") + back(); compare(query,""); verify(opened); back(); verify(!opened); compare(dismissals,1); compare(calls.length,0) + } + function test_recentsPickThenMenuThenDismiss() { + opened=true; actionsOpen=true; actionPage="pick" + BackLink.register(root,root.recentsBack,"surface","recent apps") + back(); compare(actionPage,"menu"); verify(actionsOpen) + back(); verify(!actionsOpen); verify(opened) + back(); verify(!opened); compare(dismissals,1); compare(calls.length,0) + } + function test_closedOrFailingHandlerUsesUpstreamFallbackOrder() { + BackLink.register({},function(){return false},"surface","closed") + BackLink.register({},function(){throw new Error("failed handler")},"surface","failed") + back(); history() + } +} +'''.replace("\n BACK\n", "\n" + back + "\n").replace("\n QUICK\n", "\n" + quick + "\n").replace("\n DRAWER\n", "\n" + drawer + "\n").replace("\n RECENTS\n", "\n" + recents + "\n") +runner = shutil.which("qmltestrunner6") or shutil.which("/usr/lib/qt6/bin/qmltestrunner") +if not runner: + raise SystemExit(77) +with tempfile.TemporaryDirectory(prefix="browser-back-") as temporary: + directory = Path(temporary) + (directory / "runtime").mkdir(mode=0o700) + source = directory / "omamobile.back" + source.mkdir() + for name in ("BackLink.js", "BackLinkClient.qml", "BackModel.js"): + shutil.copyfile(pkg / "plugins/omamobile.back" / name, source / name) + (source / "tst_back.qml").write_text(qml) + env = os.environ.copy() + env.update(QT_QPA_PLATFORM="offscreen", QT_QUICK_BACKEND="software", QT_QPA_PLATFORMTHEME="generic", XDG_RUNTIME_DIR=str(directory / "runtime")) + env.pop("QT_PLUGIN_PATH", None) + env.pop("QT_QPA_GENERIC_PLUGINS", None) + result = subprocess.run([runner, "-input", str(source / "tst_back.qml")], env=env) + raise SystemExit(result.returncode) diff --git a/packages/omamobile-shell/test/back-surfaces.py b/packages/omamobile-shell/test/back-surfaces.py index 39258735e..80f9833b4 100755 --- a/packages/omamobile-shell/test/back-surfaces.py +++ b/packages/omamobile-shell/test/back-surfaces.py @@ -31,6 +31,9 @@ "omamobile.voice/Voice.qml": ["voice settings", "voice result"], "omamobile.home/Home.qml": ["home screen"], "omamobile.home/OwlCell.qml": ["widget screen"], + "omamobile.quicksettings/QuickSettings.qml": ["quick settings"], + "omamobile.launcher/Launcher.qml": ["app drawer"], + "omamobile.switcher/Switcher.qml": ["recent apps"], } @@ -73,7 +76,7 @@ def body_of(text, head): # Nothing else loads the client unseen by this test. for path in plugins.glob("*/*.qml"): rel = str(path.relative_to(plugins)) - if rel not in EXPECT and rel != "omamobile.back/BackLinkClient.qml": + if rel not in EXPECT and rel not in ("omamobile.back/BackLinkClient.qml", "omamobile.back/Back.qml"): assert MARK not in path.read_text(), "%s registers with Back but isn't tested here" % rel FAKES = ''' @@ -86,6 +89,7 @@ def body_of(text, head): property bool oskOpen: false property bool languagesOpen: false property bool opened: false + property bool navigationOpen: false property bool screenOpen: false property bool authPending: false property string phase: "idle" @@ -94,6 +98,7 @@ def body_of(text, head): property var layersOver: ({}) property var calls: [] function note(n) { calls = calls.concat([n]) } + function navigationBack() { note("navigationBack"); opened = false; navigationOpen = false; return true } function hideKeyboard() { note("hideKeyboard"); oskOpen = false } function closeLanguages() { note("closeLanguages"); languagesOpen = false } function back() { note("back"); opened = false; screenOpen = false; return true } @@ -119,7 +124,8 @@ def body_of(text, head): ''' back_source = (plugins / "omamobile.back/Back.qml").read_text() -back_fn = body_of(back_source, " function back() {") +back_fn = body_of(back_source, " function back(payloadJson, startedToplevel) {") +back_fn = back_fn.replace("ToplevelManager.activeToplevel", "manager.activeToplevel").replace("Hyprland.activeToplevel", "hyprSource.activeToplevel") TEST = r'''import QtQuick import QtTest @@ -133,7 +139,11 @@ def body_of(text, head): name: "BackSurfaces" // Back.qml's own back(), as written. - function back() BACK_FN + function back(payloadJson, startedToplevel) BACK_FN + QtObject { id: manager; property var activeToplevel: null } + QtObject { id: hyprSource; property var activeToplevel: null } + Loader { id: backLink; source: "omamobile.back/BackLinkClient.qml" } + function initTestCase() { tryVerify(function() { return backLink.item !== null }) } function names() { return BackLink.names().join(",") } function sent() { return Quickshell.executed.length } @@ -147,6 +157,9 @@ def body_of(text, head): Component { id: home; SurfHomeScreen {} } Component { id: wscreen; SurfWidgetScreen {} } Component { id: plain; BackLinkClient {} } + Component { id: quick; SurfQuickSettings {} } + Component { id: drawer; SurfAppDrawer {} } + Component { id: recents; SurfRecentApps {} } function init() { BackLink.clear(); Quickshell.executed = [] } @@ -167,6 +180,9 @@ def body_of(text, head): compare(JSON.stringify(Quickshell.executed[0]), JSON.stringify(BackModel.ESCAPE_ARGV)) } + function test_quickSettings() { alone(make(quick), "quick settings", function(o) { o.fake.navigationOpen = true }, "navigationBack") } + function test_appDrawer() { alone(make(drawer), "app drawer", function(o) { o.fake.opened = true }, "navigationBack") } + function test_recentApps() { alone(make(recents), "recent apps", function(o) { o.fake.opened = true }, "navigationBack") } function test_keyboard() { alone(make(kb), "keyboard", function(o) { o.fake.oskOpen = true }, "hideKeyboard") } function test_permissionSheet() { alone(make(perm), "permission sheet", function(o) { o.fake.opened = true }, "back") } function test_fingerprintSetup() { alone(make(finger), "fingerprint setup", function(o) { o.fake.screenOpen = true }, "back") } From c206f830eee452cae2b7bd98fe1f4dde6964eeec Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Wed, 11 Nov 2026 12:09:52 -0600 Subject: [PATCH 2/3] TOUCH-PLAN: record physical 6a Back and dialog qualification Separate physical browser/keyboard-first/Qt results from direct native-surface and permission checks. Name the exact installed artifact and retain latency and reference-phone gates. Co-Authored-By: Codex --- docs/TOUCH-PLAN.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/TOUCH-PLAN.md b/docs/TOUCH-PLAN.md index eed498dda..7b20e0be2 100644 --- a/docs/TOUCH-PLAN.md +++ b/docs/TOUCH-PLAN.md @@ -123,6 +123,40 @@ correction passed physical dialog checks with keyboard hidden and visible, and normal typing afterward. That Escape mechanism is now supplied by main. These observations do not qualify this new integration's native ordering. +### Pixel 6a verification, 2026-11-11 + +The revised combined package was subsequently installed and physically tested: +`omamobile-shell 0.2.119-1`, integration +`83326ed6d09684ae80f38c9360e8c4e864d32614`, SHA-256 +`02e0acadd2568bf167946a87c740626fffb59068918271bdb2026fac799e0270`, on +`7.3.0-rc6-omamobile-bluejay-input-gated0`. Installation and cold shell restart +were gated on an unlocked session. No new QML/config errors appeared; all six +required smoke checks passed and package verification found 370 files, none +altered. Policy, the complete combined shell suite, independent review and +published-head repository/every-package CI passed. + +The owner confirmed both physical browser edges return Page two to Page one. +With text entered and the keyboard visible, first Back hid the keyboard and +left Page two; next Back navigated. The final DOM reports Page one, +`back_forward` navigation and Escape count zero. The actual Qt Controls dialog +also passed physically: five typed characters, first swipe hides only the +keyboard, next swipe delivers Qt Escape16777216 and rejects/closes the dialog. +Normal idle lock, input-gate refusal while locked and owner unlock were observed. + +Running-shell calls also verified quick settings, Wi-Fi, Bluetooth, recorder, +drawer and recents without changing the underlying browser's history or Escape +count. A real Access backend request was dismissed unanswered. Those surface +and permission observations are handler/dispatch checks; the physical results +above belong to the browser and Qt dialog. No formal physical release-to-frame +latency was measured. Maintainer Pixel 7 Pro qualification remains before merge. + +Task browsers, server, fixtures and CDP tunnel were stopped and task-only data +removed. The personal clock, flags and saved zoom were preserved, with only +main's expected remote-session disable added to the profile. The phone returned +home. These results belong to the exact combined artifact, not a later kernel +or an unrelated subsequently merged shell change. + + Userspace runbook (low risk): 1. Run policy, complete shell suite, current native-surface/routing/model and From 1aee2fea0ebae0f4ad6f5265f800de93df6642ba Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Wed, 11 Nov 2026 12:11:50 -0600 Subject: [PATCH 3/3] device/bluejay: record November 11 userspace qualification Link the precise combined-package results and distinguish physical browser and Qt checks from handler checks and untested revised kernels. Co-Authored-By: Codex --- device/bluejay/NOTES.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/device/bluejay/NOTES.md b/device/bluejay/NOTES.md index 0e804fbb2..0e49271b0 100644 --- a/device/bluejay/NOTES.md +++ b/device/bluejay/NOTES.md @@ -1,6 +1,26 @@ # Pixel 6a (bluejay) bring-up notes +## 2026-11-11: installed userspace and physical Back checks + +On the existing `7.3.0-rc6-omamobile-bluejay-input-gated0` development kernel, +the complete combined `omamobile-shell 0.2.119-1` package from integration +`83326ed6d09684ae80f38c9360e8c4e864d32614` passed all six required smoke checks. +The owner confirmed physical browser Back from both edges, first Back hiding +the keyboard without navigation, and subsequent Back navigating. Actual Qt +Controls typing and keyboard-first dialog dismissal also passed physically; +Qt received Escape16777216 and closed the dialog. Normal idle lock and owner +unlock passed, and the input gate refused commands while locked. + +The installed browser helper passed deferred-geometry fitting and preservation +of deliberately removed flags. Native surface and permission-request checks +were exercised through the running shell. See [TOUCH-PLAN](../../docs/TOUCH-PLAN.md) +for the exact combined artifact, physical-versus-handler evidence and remaining +latency/reference-device gates. The revised kernel topics were not booted by +this userspace test. No boot image or protected-data write occurred. Personal +settings were preserved and temporary fixtures removed. + + ## 2026-11-09: review split and slot-success audit (offline) The development source remains inspectable in [#543](https://github.com/derekross/omarchy-mobile/pull/543).