diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 4c783e778..add95b637 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -47,7 +47,7 @@ jobs:
run: |
pacman -Syu --noconfirm --needed git base-devel e2fsprogs zstd lz4 openssl \
python python-dbus python-gobject dbus nodejs dtc cpio file jq busybox \
- xz gzip qt6-declarative qt6-svg shellcheck rsync android-tools
+ xz gzip qt6-declarative qt6-svg quickshell shellcheck rsync android-tools
# Arch's nodejs can lag a simdjson soname bump: on 2026-10-29
# simdjson 5.0.8 dropped the libsimdjson.so.34 that nodejs still
# linked, and node no longer started. Only while node can't start,
diff --git a/docs/review-evidence/apps-search/README.md b/docs/review-evidence/apps-search/README.md
new file mode 100644
index 000000000..a2e6965b8
--- /dev/null
+++ b/docs/review-evidence/apps-search/README.md
@@ -0,0 +1,24 @@
+
+# Native app Search previews
+
+These are actual rendered production Search component captures using genuine
+Omarchy Commons/UI modules and neutral fictional applications. The top search
+row and compact borderless results follow the phone implementation. Icons are
+original MIT-licensed SVG test fixtures; no private application catalog,
+wallpaper, account, widget or conversation is included.
+
+The 420 x 580 captures show a reduced available viewport, as when a keyboard
+reserves part of the screen. They are not full-device screenshots and do not
+render or simulate a keyboard. Actual viewport geometry and light/dark themes
+are exercised. Neutral geometric scenery sits behind the translucent component.
+It demonstrates the tint; offscreen rendering does not execute compositor blur.
+
+The animation contains 67 actual captures spanning 2327 ms,
+encoded losslessly as animated WebP with original capture intervals (plus the
+median interval for the final frame). Identical frames may be merged by the
+encoder. There are no interpolated frames; this is not a phone FPS benchmark.
+Input, filtering, Return activation and closing run against the actual component.
+
+Native layer focus, touch typing, physical Back/Home gestures, lock/unlock,
+compositor blur and frame pacing still need exact-package device acceptance.
+The public source retains Omarchy attribution and existing licenses.
diff --git a/docs/review-evidence/apps-search/search-dark.png b/docs/review-evidence/apps-search/search-dark.png
new file mode 100644
index 000000000..89bd70698
Binary files /dev/null and b/docs/review-evidence/apps-search/search-dark.png differ
diff --git a/docs/review-evidence/apps-search/search-filtered.png b/docs/review-evidence/apps-search/search-filtered.png
new file mode 100644
index 000000000..19fa7e9ca
Binary files /dev/null and b/docs/review-evidence/apps-search/search-filtered.png differ
diff --git a/docs/review-evidence/apps-search/search-flow.webp b/docs/review-evidence/apps-search/search-flow.webp
new file mode 100644
index 000000000..f5dea0e12
Binary files /dev/null and b/docs/review-evidence/apps-search/search-flow.webp differ
diff --git a/docs/review-evidence/apps-search/search-light.png b/docs/review-evidence/apps-search/search-light.png
new file mode 100644
index 000000000..990689e54
Binary files /dev/null and b/docs/review-evidence/apps-search/search-light.png differ
diff --git a/docs/review-evidence/search-agent/README.md b/docs/review-evidence/search-agent/README.md
new file mode 100644
index 000000000..1226dcbb5
--- /dev/null
+++ b/docs/review-evidence/search-agent/README.md
@@ -0,0 +1,29 @@
+
+# Native Search: Ask Agent previews
+
+Actual rendered production QML components using genuine Omarchy Commons/UI
+modules, neutral theme scenery and fictional app/conversation fixtures.
+No private phone capture, account, prompt history, wallpaper or widget is used.
+The selected Codex name in this fixture demonstrates one configured agent;
+the UI label follows the actual default agent in normal use.
+
+The Ask card opens a conversation with an editable draft. The recording then
+clicks the actual Send control, supplies neutral reply events to the actual
+controller and returns to Search using Back. This preview transport is inert;
+no model, network, credentials or agent CLI is invoked by the visual harness.
+The separate integration fixture connects the real QML/Python transport to an
+inert CLI to exercise the functional protocol.
+
+Portrait previews use a 420 x 580 available viewport; landscape is 740 x 320.
+No keyboard is drawn or simulated. The tint is rendered over neutral scenery;
+o compositor blur or physical phone interaction is qualified here.
+
+The lossless animated WebP is encoded from106actual captures spanning3977ms,
+with the original intervals and a median interval for the final frame
+(total4014ms). The encoder merges identical frames into28encoded frames.
+No interpolated frames, physical FPS or measured compositor smoothness is
+claimed. Existing source attribution and licenses remain intact.
+
+The compact 320 x 320 preview includes the responsive control-width correction.
+Buttons can shrink and elide long labels instead of expanding the composer
+beyond its viewport. The full accessible button name remains available.
diff --git a/docs/review-evidence/search-agent/agent-flow.webp b/docs/review-evidence/search-agent/agent-flow.webp
new file mode 100644
index 000000000..1069ca928
Binary files /dev/null and b/docs/review-evidence/search-agent/agent-flow.webp differ
diff --git a/docs/review-evidence/search-agent/ask-dark.png b/docs/review-evidence/search-agent/ask-dark.png
new file mode 100644
index 000000000..9b21c562e
Binary files /dev/null and b/docs/review-evidence/search-agent/ask-dark.png differ
diff --git a/docs/review-evidence/search-agent/draft-dark.png b/docs/review-evidence/search-agent/draft-dark.png
new file mode 100644
index 000000000..7cef3cc8f
Binary files /dev/null and b/docs/review-evidence/search-agent/draft-dark.png differ
diff --git a/docs/review-evidence/search-agent/reply-compact.png b/docs/review-evidence/search-agent/reply-compact.png
new file mode 100644
index 000000000..aeb79d287
Binary files /dev/null and b/docs/review-evidence/search-agent/reply-compact.png differ
diff --git a/docs/review-evidence/search-agent/reply-dark.png b/docs/review-evidence/search-agent/reply-dark.png
new file mode 100644
index 000000000..f0caaa0bc
Binary files /dev/null and b/docs/review-evidence/search-agent/reply-dark.png differ
diff --git a/docs/review-evidence/search-agent/reply-landscape.png b/docs/review-evidence/search-agent/reply-landscape.png
new file mode 100644
index 000000000..ecfdd1d31
Binary files /dev/null and b/docs/review-evidence/search-agent/reply-landscape.png differ
diff --git a/docs/review-evidence/search-agent/reply-light.png b/docs/review-evidence/search-agent/reply-light.png
new file mode 100644
index 000000000..35b411b47
Binary files /dev/null and b/docs/review-evidence/search-agent/reply-light.png differ
diff --git a/packages/omamobile-shell/LICENSE.omarchy b/packages/omamobile-shell/LICENSE.omarchy
new file mode 100644
index 000000000..f12cfa766
--- /dev/null
+++ b/packages/omamobile-shell/LICENSE.omarchy
@@ -0,0 +1,20 @@
+Copyright (c) David Heinemeier Hansson
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/packages/omamobile-shell/PKGBUILD b/packages/omamobile-shell/PKGBUILD
index 4517ea59a..58e449bea 100644
--- a/packages/omamobile-shell/PKGBUILD
+++ b/packages/omamobile-shell/PKGBUILD
@@ -16,7 +16,7 @@ depends=(omarchy omamobile-apps 'omamobile-omarchy>=0.1.11' 'omamobile-owl-widge
dnsmasq # the Hotspot tile: NetworkManager's shared mode hands out addresses with it
foot xdg-terminal-exec # guard for hand-built/partial installations
xdg-desktop-portal-gnome) # the file chooser (portal/hyprland-portals.conf)
-checkdepends=(nodejs) # test/weather.py runs HomeModel.js under node
+checkdepends=(nodejs quickshell) # test/weather.py runs HomeModel.js under node
optdepends=('fprintd: fingerprint setup and unlock (with omamobile-fingerprint)'
'omamobile-voice: the speech model for voice input, so Voxtype works with no download (the root image has it)'
'voxtype-bin: voice input (the root image has it; or Install > AI > Dictation)')
diff --git a/packages/omamobile-shell/README.md b/packages/omamobile-shell/README.md
index 3efb5644d..df1c19af9 100644
--- a/packages/omamobile-shell/README.md
+++ b/packages/omamobile-shell/README.md
@@ -6,7 +6,7 @@ Omarchy Mobile's phone profile for Omarchy's own shell. It isn't a fork: these a
| --- | --- |
| `plugins/omamobile.bar` | Phone status bar (a full `bar` plugin) |
| `plugins/omamobile.quicksettings` | Pull-down quick settings |
-| `plugins/omamobile.launcher` | Home bar: app search, app grid and a prompt to the user's Omarchy default agent; over an app, the home pill in a 44 px strip that reserves its height, so apps end above it (as on Android it is just the pill: double-tap for the keyboard, hold for the voice bar) |
+| `plugins/omamobile.launcher` | Home bar: a separate native app-search view on tap; App Library and the existing optional agent flow on swipe; over an app, the home pill in a 44 px strip that reserves its height, so apps end above it (as on Android it is just the pill: double-tap for the keyboard, hold for the voice bar) |
| `plugins/omamobile.switcher` | Recent apps: swipe up on the dock, or swipe up and hold on the home pill over an app; hold a card to show the app with another one, or give it its own screen again |
| `plugins/omamobile.home` | Home screens: pages of apps and widgets on the wallpaper, with an edit mode. The built-ins include every widget in Simon Schubert's [omarchy-widgets](https://github.com/SimonSchubert/omarchy-widgets) `widgets/simonschubert/` (MIT): the OWL originals, from the `omamobile-owl-widgets` package, run by our own OWL runtime (`owl/`, see `owl/SPEC-NOTES.md`). `widgets/OWL.md` is his OWL language guide (MIT, `widgets/LICENSE-owl-guide`) |
| `plugins/omamobile.keyboard` | The on-screen keyboard's show and hide calls, for the home pill (double-tap it), the keyboard's Hide key and scripts; a keyboard shown by hand goes away when the home screen comes up; the language sheet for the keyboard's globe key |
@@ -102,3 +102,105 @@ Open, save and choose-a-folder requests through the portal (Qt, GTK, Electron an
The package contract follows omarchy-mac's: `./install DESTDIR` stages files and enables nothing, `test/all` runs the package's own tests, and `version` holds the version.
Develop on a desktop with `phone/dev/run-desktop` from the repo root.
+
+## Native app Search
+
+A tap on the home search field opens app search directly. Swiping up still
+opens the App Library and its existing optional agent flow. Set the launcher's
+`nativeSearch` setting to `false` to retain the previous dock-tap behavior.
+Search uses Omarchy's application library and normal app-launch command. It
+does not index files, select an agent or access accounts.
+
+The view follows Commons palette, font, spacing, controls and corner settings;
+its animation follows `Style.duration` when available. A full-screen background
+takes no input, the content respects the status/keyboard reservations, and the
+existing Home strip remains visible even after manually hiding the keyboard.
+Back closes Search in process before the usual Escape fallback. Home and app
+activation release its text input before changing screens.
+
+Native focus is briefly primed with Exclusive, then released to OnDemand, using
+the focus lifecycle from Omarchy's MIT-licensed `shell/Ui/KeyboardPanel.qml`.
+That component is present in both supported Omarchy package families. Its
+David Heinemeier Hansson copyright and license are retained in
+`LICENSE.omarchy`. Offscreen component tests verify cancellation and focus
+intent; a phone acceptance must separately verify first-tap OSK activation,
+keyboard touches, Back/Home, immediate reopen and lock interaction.
+
+Native Search cancels pending focus and closes when the launcher's existing session-lock observation reports locked. Unlocking never reopens it without a new explicit tap. This observation is asynchronous and is not a security boundary or a replacement for the compositor lock protocol. Existing fullscreen exclusion of Home/Back gesture strips remains in force; a Search opened over fullscreen can still close using its visible close button or Escape. The Search panels currently use Quickshell's default output; multi-output active-screen routing is not qualified by the offscreen tests.
+
+### Search presentation
+
+Search retains the phone layout: the query row stays at the top, followed by
+three suggested apps, or matching results while typing. App rows have icons,
+names and descriptions without an enclosing border. Colors, font family and
+size, spacing, control borders, corner rounding and motion follow Commons.
+The theme background is painted once as a translucent tint over the underlying
+screen. No wallpaper is copied or sampled by the client.
+
+Themes can set `[controls]` keys `mobile-search-backdrop-alpha` (default 0.92)
+and `mobile-search-card-alpha` (default 0.94) in `shell.toml`. Values are clamped
+by Omarchy's alpha-token API; setting both to 1 gives opaque surfaces. Existing
+`[style]` overrides are also read by Omarchy. Older hosts without the alpha API
+use the defaults. Rounding follows the configured Hyprland/theme value; Search
+does not impose capsules or a minimum corner radius.
+
+Optional compositor blur can be scoped to the Search background only, when
+blur is already enabled in the user's compositor configuration:
+
+```lua
+hl.layer_rule({
+ name = "omamobile-app-search-glass",
+ match = { namespace = "^omamobile-app-search-background$" },
+ blur = true,
+ ignore_alpha = 0.05,
+ xray = false,
+})
+```
+
+This example does not change global blur settings. Search remains usable
+without blur. Component previews show translucency over neutral test scenery;
+they do not execute or qualify compositor blur, a real keyboard or phone frame
+pacing.
+
+## Ask Agent in native Search
+
+The Ask card opens an in-place conversation with the configured default agent.
+Search text becomes an editable draft; only Send or Ctrl+Enter submits it.
+Back returns to app search. Home and close dismiss Search; both dismissal and
+locking cancel an active request. An idle local bridge retains the conversation
+in memory, without polling or running the agent while hidden. New chat resets
+it. Changing provider or the selected account home starts a fresh conversation.
+
+The first native adapter supports an already installed Codex CLI. Its existing
+login, account selection, model/configuration and approval policy are retained;
+commands use the workspace-write sandbox. Other configured agents have an
+explicit terminal handoff, using the existing Omarchy route. No provider is
+selected or installed automatically. This contribution adds no account/login
+store, microphone facade, dictation runtime or custom user configuration.
+
+The backend's JSONL protocol carries literal messages over stdin, never shell
+command text. Request identities, reset acknowledgements and cancellation are
+bound to the owning process. A cancelled follow-up retains the last completed
+conversation; stale output cannot populate a later request. A stopped local
+bridge can be restarted through explicit conversation entry or New chat before
+another Send. Helper stderr and tool events are never copied into the UI or a
+new log. Assistant content is displayed as plain text.
+
+Task artifacts remain in private per-session workspaces under
+`${XDG_STATE_HOME:-~/.local/state}/omamobile/agent-chat/`; shutdown removes only
+empty workspace directories. Normal CLI session storage remains the CLI's own.
+The bridge does not create another transcript or copy credentials. Inputs,
+output framing and request time are bounded; failures remain visible without
+weakening sandbox or approval settings. The current request deadline is 180
+seconds and the composer accepts at most 8,192 UTF-16 code units.
+
+Protocol reference: [Codex non-interactive execution](https://learn.chatgpt.com/docs/non-interactive-mode).
+Native adapters for additional agents require their own verified protocol and
+sandbox/approval handling. Do not infer support from an installed executable.
+
+`test/agent-chat.py` runs real subprocess fixtures against inert temporary CLIs.
+`test/agent-chat-ui.py` connects the actual QML controller to the real Python
+bridge with an inert CLI, including resume, account changes, reset and transport
+recovery. CI installs Quickshell so that integration runs there; environments
+without it report an explicit skip. These checks make no cloud requests and
+are not phone keyboard, touch, compositor or frame-pacing qualification.
diff --git a/packages/omamobile-shell/bin/omamobile-agent-chat b/packages/omamobile-shell/bin/omamobile-agent-chat
new file mode 100755
index 000000000..261a9490c
--- /dev/null
+++ b/packages/omamobile-shell/bin/omamobile-agent-chat
@@ -0,0 +1,8 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: MIT
+import sys
+from pathlib import Path
+source = Path(__file__).resolve().parent.parent/'lib'
+sys.path.insert(0, str(source if (source/'agent_chat.py').is_file() else Path('/usr/lib/omamobile-shell')))
+from agent_chat import main
+raise SystemExit(main())
diff --git a/packages/omamobile-shell/install b/packages/omamobile-shell/install
index f886a7c8d..d3c965c0c 100755
--- a/packages/omamobile-shell/install
+++ b/packages/omamobile-shell/install
@@ -8,6 +8,7 @@ destination=${1:?Usage: ./install DESTDIR}
for program in bin/*; do
install -Dm755 "$program" "$destination/usr/bin/${program#bin/}"
done
+install -Dm644 lib/agent_chat.py "$destination/usr/lib/omamobile-shell/agent_chat.py"
while IFS= read -r -d '' file; do
install -Dm644 "$file" "$destination/usr/share/omamobile/shell/$file"
done < <(find plugins profile hypr branding -type f -print0)
@@ -70,6 +71,7 @@ install -Dm644 applications/omamobile-agent.desktop "$destination/usr/share/appl
install -Dm644 applications/omamobile-open-intent.desktop "$destination/usr/share/applications/omamobile-open-intent.desktop"
install -Dm644 applications/omamobile-update.desktop "$destination/usr/share/applications/omamobile-update.desktop"
install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-shell/LICENSE"
+install -Dm644 LICENSE.omarchy "$destination/usr/share/licenses/omamobile-shell/LICENSE.omarchy"
# OWL.md is Simon Schubert's OWL guide (MIT). The built-in widgets themselves
# come from omamobile-owl-widgets, which ships the store's licence.
install -Dm644 widgets/LICENSE-owl-guide "$destination/usr/share/licenses/omamobile-shell/LICENSE-owl-guide"
diff --git a/packages/omamobile-shell/lib/agent_chat.py b/packages/omamobile-shell/lib/agent_chat.py
new file mode 100644
index 000000000..deb83db4c
--- /dev/null
+++ b/packages/omamobile-shell/lib/agent_chat.py
@@ -0,0 +1,332 @@
+# SPDX-License-Identifier: MIT
+"""Bounded native chat bridge. Credentials and transcripts stay with the CLI."""
+import json
+import os
+from pathlib import Path
+import re
+import selectors
+import shutil
+import signal
+import subprocess
+import sys
+import tempfile
+import threading
+import time
+
+MAX_LINE = 131072
+MAX_OUTPUT = 2097152
+MAX_REPLY_TEXT = 120000
+DEADLINE = 180
+ID = re.compile(r'^[A-Za-z0-9_-]{1,80}$')
+THREAD = re.compile(r'^[A-Za-z0-9_-]{1,100}$')
+
+
+def selected_provider():
+ try:
+ with (Path.home()/'.config/omarchy/defaults/agent').open('rb') as stream:
+ raw = stream.readline(130)
+ if len(raw) > 128: return ''
+ value = raw.decode('utf-8').strip()
+ return value if ID.fullmatch(value) else ''
+ except (OSError, UnicodeError):
+ return ''
+
+
+def qualified(path):
+ if not path.is_file() or not os.access(path, os.X_OK): return False
+ try:
+ if path.resolve().name == 'mise': return False
+ with path.open('rb') as stream: prefix = stream.read(8192)
+ return not any(word in prefix for word in (b'omarchy-agent-account-exec', b'mise install', b'mise use'))
+ except OSError:
+ return False
+
+
+def installed_binary(provider):
+ # Never execute Omarchy's account-exec or mise dispatchers: either may install.
+ for folder in os.get_exec_path():
+ if any(part in ('command-wrappers', 'shims') for part in Path(folder).parts):
+ continue
+ path = Path(folder)/provider
+ if qualified(path):
+ return str(path)
+ data = Path(os.environ.get('MISE_DATA_DIR', str(Path(os.environ.get('XDG_DATA_HOME', str(Path.home()/'.local/share')))/'mise')))
+ for path in (data/'installs'/provider/'latest/bin'/provider, data/'installs'/provider/'latest'/provider):
+ if qualified(path):
+ return str(path)
+ return ''
+
+
+def account_environment(provider):
+ env = dict(os.environ)
+ key = {'codex': 'CODEX_HOME', 'claude': 'CLAUDE_CONFIG_DIR'}.get(provider)
+ value = env.get(key, '') if key else ''
+ if key and not value:
+ helper = shutil.which('omarchy-agent-account-home')
+ if helper:
+ result = subprocess.run([helper, provider], stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL, timeout=3, check=True)
+ if len(result.stdout) > 4096:
+ raise ValueError('account')
+ value = result.stdout.decode().strip()
+ if value:
+ env[key] = value
+ if key:
+ env['OMARCHY_AGENT_'+provider.upper()+'_HOME'] = value
+ return env, (provider, value)
+
+
+def classify_error(value):
+ # Examine only bounded structured failure fields; never forward their text.
+ pieces = []
+ for part in (value, value.get('error', {})):
+ if isinstance(part, dict):
+ for key in ('code', 'message', 'type'):
+ text = part.get(key)
+ if isinstance(text, str): pieces.append(text[:2048].lower())
+ text = ' '.join(pieces)
+ if any(word in text for word in ('unauthorized', 'authentication', 'not logged in', 'login required', '401')): return 'auth_required'
+ if any(word in text for word in ('sandbox', 'bwrap', 'landlock')): return 'sandbox_failed'
+ if any(word in text for word in ('approval required', 'approval request', 'requires approval', 'approval_required')): return 'approval_required'
+ return 'agent_failed'
+
+
+def private_state(path):
+ if not path.is_absolute(): raise ValueError('state')
+ descriptor = os.open('/', os.O_RDONLY | os.O_DIRECTORY)
+ try:
+ for part in path.parts[1:]:
+ if part in ('.', '..'): raise ValueError('state')
+ try: os.mkdir(part, 0o700, dir_fd=descriptor)
+ except FileExistsError: pass
+ child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=descriptor)
+ os.close(descriptor); descriptor = child
+ if os.fstat(descriptor).st_uid != os.getuid(): raise ValueError('state')
+ os.fchmod(descriptor, 0o700)
+ finally:
+ os.close(descriptor)
+
+
+class Codex:
+ @staticmethod
+ def command(binary, thread):
+ args = [binary, 'exec', '--sandbox', 'workspace-write']
+ if thread:
+ args += ['resume', thread]
+ return args + ['--json', '--skip-git-repo-check', '-']
+
+ @staticmethod
+ def event(value):
+ kind = value.get('type')
+ if kind == 'thread.started':
+ thread = value.get('thread_id', '')
+ return ('thread', thread) if isinstance(thread, str) and THREAD.fullmatch(thread) else (None, None)
+ item = value.get('item', {})
+ if kind == 'item.completed' and isinstance(item, dict) and item.get('type') == 'agent_message':
+ text = item.get('text')
+ return ('reply', text) if isinstance(text, str) else (None, None)
+ if kind in ('turn.failed', 'error'):
+ return ('failure', classify_error(value))
+ return (None, None)
+
+
+ADAPTERS = {'codex': Codex}
+
+
+class Server:
+ def __init__(self, output=sys.stdout):
+ self.output = output
+ self.lock = threading.RLock()
+ self.active = None
+ self.thread = None
+ self.binding = None
+ self.seen = set()
+ self.reset_pending = False
+ state = Path(os.environ.get('XDG_STATE_HOME', str(Path.home()/'.local/state')))/'omamobile/agent-chat'
+ private_state(state)
+ self.workspace = Path(tempfile.mkdtemp(prefix='session-', dir=state))
+
+ def emit(self, kind, request=None, **fields):
+ with self.lock:
+ value = dict(type=kind, **fields)
+ if request is not None:
+ value['id'] = request
+ self.output.write(json.dumps(value, ensure_ascii=True, separators=(',', ':'))+'\n')
+ self.output.flush()
+
+ def capabilities(self):
+ provider = selected_provider()
+ installed = bool(provider and installed_binary(provider))
+ native = provider in ADAPTERS and installed
+ reason = '' if native else ('select_agent' if not provider else 'install_agent' if not installed else 'terminal_required')
+ self.emit('capabilities', provider=provider, nativeChat=native, installed=installed, reason=reason)
+
+ def cancel(self, request=None):
+ with self.lock:
+ active = self.active
+ if active and (request is None or request == active['id']):
+ active['cancel'].set()
+
+ def handle(self, value):
+ if not isinstance(value, dict):
+ self.emit('error', code='invalid_request'); return
+ op = value.get('op')
+ if op == 'capabilities':
+ self.capabilities(); return
+ if op == 'cancel':
+ self.cancel(value.get('id')); return
+ if op == 'reset':
+ self.cancel()
+ with self.lock:
+ self.thread = None; self.binding = None
+ if self.active: self.reset_pending = True
+ else: self.emit('reset')
+ return
+ request = value.get('id')
+ if op != 'send' or not isinstance(request, str) or not ID.fullmatch(request):
+ self.emit('error', code='invalid_request'); return
+ prompt = value.get('prompt')
+ if not isinstance(prompt, str) or not prompt.strip() or len(prompt.encode()) > 32768:
+ self.emit('error', request, code='invalid_prompt'); return
+ provider = selected_provider()
+ if value.get('provider') != provider or provider not in ADAPTERS:
+ self.emit('error', request, code='provider_changed' if value.get('provider') != provider else 'terminal_required'); return
+ binary = installed_binary(provider)
+ if not binary:
+ self.emit('error', request, code='install_agent'); return
+ with self.lock:
+ if self.active:
+ self.emit('error', request, code='busy'); return
+ if request in self.seen or len(self.seen) >= 4096:
+ self.emit('error', request, code='request_id_used'); return
+ self.seen.add(request)
+ active = dict(id=request, cancel=threading.Event())
+ self.active = active
+ worker = threading.Thread(target=self.run, args=(active, provider, binary, prompt))
+ active['worker'] = worker
+ worker.start()
+
+ def run(self, active, provider, binary, prompt):
+ request = active['id']; process = None; code = None
+ try:
+ env, binding = account_environment(provider)
+ with self.lock:
+ if self.binding is not None and self.binding != binding:
+ self.thread = None
+ self.emit('reset', reason='account_changed')
+ self.binding = None
+ elif self.binding != binding:
+ self.thread = None
+ thread = self.thread
+ if active['cancel'].is_set():
+ return
+ process = subprocess.Popen(ADAPTERS[provider].command(binary, thread),
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+ cwd=str(self.workspace), env=env, start_new_session=True)
+ self.emit('started', request)
+ outbound = prompt.encode()
+ os.set_blocking(process.stdin.fileno(), False)
+ pending = b''; total = 0; started = time.monotonic(); new_thread = thread; replies = []
+ with selectors.DefaultSelector() as poll:
+ poll.register(process.stdout, selectors.EVENT_READ)
+ while True:
+ if active['cancel'].is_set(): break
+ if time.monotonic()-started > DEADLINE:
+ code = 'timeout'; break
+ if outbound:
+ try:
+ sent = os.write(process.stdin.fileno(), outbound)
+ outbound = outbound[sent:]
+ if not outbound: process.stdin.close()
+ except BlockingIOError: pass
+ if not poll.select(.1): continue
+ chunk = os.read(process.stdout.fileno(), 16384)
+ if not chunk: break
+ total += len(chunk); pending += chunk
+ if total > MAX_OUTPUT or len(pending) > MAX_LINE:
+ code = 'output_limit'; break
+ while b'\n' in pending:
+ line, pending = pending.split(b'\n', 1)
+ try: event = json.loads(line)
+ except (ValueError, UnicodeError): continue
+ if not isinstance(event, dict): continue
+ kind, text = ADAPTERS[provider].event(event)
+ if kind == 'thread':
+ if thread and text != thread: code = 'session_mismatch'
+ else: new_thread = text
+ elif kind == 'failure': code = text
+ elif kind == 'reply' and not active['cancel'].is_set():
+ replies.append(text)
+ if not active['cancel'].is_set() and not code:
+ try: status = process.wait(timeout=2)
+ except subprocess.TimeoutExpired: status = -1
+ if status or not replies: code = 'agent_failed'
+ elif not new_thread:
+ code = 'session_unavailable'
+ else:
+ with self.lock:
+ if not active['cancel'].is_set():
+ reply = '\n\n'.join(replies)
+ wire = json.dumps(dict(type='reply', id=request, text=reply), ensure_ascii=True, separators=(',', ':')).encode()
+ if len(reply) > MAX_REPLY_TEXT or len(wire)+1 > MAX_LINE:
+ code = 'output_limit'
+ else:
+ self.thread = new_thread; self.binding = binding
+ self.emit('reply', request, text=reply)
+ except (OSError, ValueError, subprocess.SubprocessError):
+ code = 'agent_unavailable'
+ finally:
+ if process:
+ if process.poll() is None:
+ try: os.killpg(process.pid, signal.SIGTERM)
+ except ProcessLookupError: pass
+ try: process.wait(timeout=1)
+ except subprocess.TimeoutExpired:
+ if process.poll() is None:
+ try: os.killpg(process.pid, signal.SIGKILL)
+ except ProcessLookupError: pass
+ process.wait()
+ process.stdout.close()
+ if not process.stdin.closed: process.stdin.close()
+ with self.lock:
+ cancelled = active['cancel'].is_set()
+ self.active = None
+ if cancelled: self.emit('cancelled', request)
+ elif code: self.emit('error', request, code=code)
+ else: self.emit('done', request)
+ if self.reset_pending:
+ self.reset_pending = False
+ self.emit('reset')
+
+ def close(self):
+ self.cancel()
+ active = self.active
+ if active:
+ active['worker'].join(timeout=8)
+ if active['worker'].is_alive():
+ # Do not remove a workspace while a child could still use it.
+ return
+ try: self.workspace.rmdir()
+ except OSError: pass # Preserve client-created task artifacts; never recurse.
+
+
+def main():
+ if os.geteuid() == 0: return 1
+ server = Server()
+ def shutdown(signum, frame):
+ raise SystemExit(0)
+ signal.signal(signal.SIGTERM, shutdown)
+ try:
+ server.capabilities()
+ while True:
+ line = sys.stdin.buffer.readline(MAX_LINE+1)
+ if not line: break
+ if len(line) > MAX_LINE:
+ server.emit('error', code='input_limit'); break
+ try: value = json.loads(line)
+ except (ValueError, UnicodeError):
+ server.emit('error', code='invalid_request'); continue
+ server.handle(value)
+ finally:
+ server.close()
+ return 0
diff --git a/packages/omamobile-shell/plugins/omamobile.back/Back.qml b/packages/omamobile-shell/plugins/omamobile.back/Back.qml
index 9e1c6d615..39a82872b 100644
--- a/packages/omamobile-shell/plugins/omamobile.back/Back.qml
+++ b/packages/omamobile-shell/plugins/omamobile.back/Back.qml
@@ -6,6 +6,7 @@ import Quickshell.Wayland
import qs.Commons
import qs.Commons as Commons
import "BackModel.js" as BackModel
+import "../omamobile.launcher/AppsSearchLink.js" as AppsSearchLink
// 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
@@ -38,6 +39,7 @@ Item {
// `shell call omamobile.back back ''`: the same as the gesture.
function back() {
+ if (AppsSearchLink.back()) return "search"
Quickshell.execDetached(BackModel.ESCAPE_ARGV)
return "ok"
}
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/AgentChatController.qml b/packages/omamobile-shell/plugins/omamobile.launcher/AgentChatController.qml
new file mode 100644
index 000000000..965e4f737
--- /dev/null
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/AgentChatController.qml
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: MIT
+import QtQuick
+import Quickshell.Io
+
+// Owns one ephemeral backend session. Only explicit Send starts model work.
+QtObject {
+ id: root
+ property string provider: ""
+ property bool enabled: false
+ property bool processWanted: true
+ property bool transportEnabled: true // offline tests replace only the transport
+ property bool available: false
+ property bool installed: false
+ property bool capabilityKnown: false
+ property string reason: ""
+ property bool busy: false
+ property bool resetPending: false
+ property bool activeAccepted: false
+ property string submittedText: ""
+ signal accepted(string prompt)
+ property string error: ""
+ property var messages: []
+ property int generation: 0
+ property int sequence: 0
+ property string activeId: ""
+ property string stoppingId: ""
+ signal outbound(var message)
+
+ function write(message) {
+ outbound(message)
+ if (transportEnabled && process.running) process.write(JSON.stringify(message) + "\n")
+ }
+ function probe() { write({op: "capabilities", provider: provider}) }
+ function cancel() {
+ var id = activeId
+ activeId = "" // reject every late content event before cancellation
+ activeAccepted = false
+ submittedText = ""
+ if (id) { stoppingId = id; busy = true; write({op: "cancel", id: id}) }
+ else if (!stoppingId) busy = false
+ }
+ function reset() {
+ cancel()
+ ++generation
+ messages = []
+ error = ""
+ resetPending = enabled
+ available = false
+ capabilityKnown = false
+ if (enabled) { processWanted = true; write({op: "reset"}) }
+ }
+ function shutdown() {
+ reset()
+ available = false
+ installed = false
+ capabilityKnown = false
+ reason = ""
+ }
+ function send(prompt) {
+ var text = String(prompt || "").trim()
+ if (text.length > 8192) { error = "This message is too long. Keep it under 8,192 characters."; return false }
+ if (!enabled || busy || resetPending || !available || !installed || !text) return false
+ error = ""
+ activeId = String(generation) + "-" + String(++sequence)
+ submittedText = text
+ activeAccepted = false
+ busy = true
+ write({op: "send", id: activeId, provider: provider, prompt: text})
+ return true
+ }
+ function receive(line) {
+ if (typeof line === "string" && line.length > 262144) return
+ var event
+ try { event = typeof line === "string" ? JSON.parse(line) : line } catch (e) { return }
+ if (!event || !enabled) return
+ if (event.type === "reset") {
+ if (resetPending) { resetPending = false; stoppingId = ""; busy = false; probe() }
+ else if (event.reason === "account_changed") messages = []
+ return // account-change reset may precede the current request's started
+ }
+ if (event.type === "capabilities") {
+ if (resetPending) return
+ if (event.provider !== provider) return
+ capabilityKnown = true
+ available = event.nativeChat === true && event.installed === true
+ installed = event.installed === true
+ reason = available ? "" : installed ? "This agent uses its terminal app. Your draft can continue there." : "This agent is not installed. Choose another agent or install its terminal app."
+ return
+ }
+ if (stoppingId && String(event.id) === stoppingId) {
+ if (event.type === "done" || event.type === "cancelled" || event.type === "error") { stoppingId = ""; busy = false }
+ return
+ }
+ if (!activeId || String(event.id) !== activeId) return
+ if (event.type === "started") {
+ if (!activeAccepted) {
+ activeAccepted = true
+ messages = messages.concat([{role: "user", text: submittedText}, {role: "assistant", text: ""}]).slice(-100)
+ accepted(submittedText)
+ }
+ } else if (event.type === "delta" || event.type === "reply") {
+ if (!activeAccepted) return
+ var rows = messages.slice()
+ if (!rows.length) return
+ var previous = rows[rows.length - 1]
+ rows[rows.length - 1] = {role: "assistant", text: (event.type === "delta" ? previous.text + String(event.text || "") : String(event.text || "")).slice(0, 128000)}
+ messages = rows
+ } else if (event.type === "done" || event.type === "cancelled" || event.type === "error") {
+ if (event.type === "error") {
+ var errors = {
+ auth_required: "Sign in using the agent's terminal app, then try again.",
+ sandbox_failed: "The agent could not start its required sandbox. Continue in its terminal app.",
+ approval_required: "This request needs approval in the agent's terminal app.",
+ provider_changed: "The selected agent changed. Your draft was kept; try again.",
+ busy: "The agent is still stopping its previous request. Your draft was kept; try again.",
+ invalid_request: "The request was not accepted. Your draft was kept.",
+ too_large: "This message is too long. Keep it under 8,192 characters."
+ }
+ error = errors[event.code] || "The agent could not complete this request. Try again or continue in its terminal app."
+ }
+ busy = false
+ activeId = ""
+ }
+ }
+ function ensureStarted() { if (enabled && !processWanted) reset() }
+ function transportEnded() {
+ if (!enabled) return
+ cancel()
+ processWanted = false
+ stoppingId = ""
+ busy = false
+ resetPending = false
+ available = false
+ capabilityKnown = true
+ error = "The agent service stopped. Continue in its terminal app or select another agent."
+ }
+ onProviderChanged: {
+ // JSONL is ordered: reset precedes the new capability probe and Send.
+ shutdown()
+ // reset ACK, not capability arrival, unlocks a provider transition.
+ }
+ onEnabledChanged: {
+ if (enabled) { if (!transportEnabled) probe() }
+ else shutdown()
+ }
+ property Timer capabilityTimeout: Timer {
+ interval: 5000
+ running: root.enabled && !root.capabilityKnown && !root.resetPending
+ onTriggered: {
+ root.capabilityKnown = true
+ root.available = false
+ root.reason = "Native conversation is unavailable. Continue in the agent terminal app."
+ }
+ }
+ property Process process: Process {
+ command: ["omamobile-agent-chat", "serve"]
+ running: root.enabled && root.transportEnabled && root.processWanted
+ stdinEnabled: true
+ onStarted: { if (root.resetPending) root.write({op:"reset"}); else root.probe() }
+ stdout: SplitParser { onRead: function(line) { root.receive(line) } }
+ // stderr may contain CLI diagnostics or account details; never display it.
+ stderr: SplitParser { onRead: function(line) {} }
+ onExited: function(code, status) { root.transportEnded() }
+ }
+}
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/AgentConversation.qml b/packages/omamobile-shell/plugins/omamobile.launcher/AgentConversation.qml
new file mode 100644
index 000000000..6eea730fb
--- /dev/null
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/AgentConversation.qml
@@ -0,0 +1,176 @@
+// SPDX-License-Identifier: MIT
+import QtQuick
+import QtQuick.Controls as Controls
+import QtQuick.Layouts
+import qs.Commons
+import qs.Commons as Commons
+
+// The phone's conversation hierarchy, with no authentication or voice facade.
+Item {
+ id: root
+ property var controller: null
+ property string agentName: "Agent"
+ property string draft: ""
+ onDraftChanged: if (composer.text !== draft) composer.text = draft
+ property color foreground: Commons.Color.menu.text
+ property color muted: Commons.Color.muted
+ property color cardColor: Commons.Color.menu.background
+ readonly property var inputField: composer
+ signal backRequested()
+ signal closeRequested()
+ signal sendRequested(string prompt)
+ signal handoffRequested(string prompt)
+ signal chooseAgentRequested()
+ signal newChatRequested()
+ readonly property int touch: Math.max(44, Style.space(44))
+
+ component Action: Rectangle {
+ id: action
+ property string label: ""
+ signal tapped()
+ implicitWidth: Math.max(root.touch, actionText.implicitWidth + Style.space(24))
+ implicitHeight: root.touch
+ // A long label or wider platform font must not enlarge the composer.
+ // Prefer the natural button width, but allow a constrained row to shrink it.
+ Layout.fillWidth: true
+ Layout.minimumWidth: root.touch
+ Layout.maximumWidth: implicitWidth
+ radius: Style.cornerRadius
+ color: actionTouch.pressed ? Style.pressedFillFor(root.foreground, Commons.Color.accent) : root.cardColor
+ opacity: enabled ? 1 : 0.45
+ Accessible.name: label
+ Accessible.role: Accessible.Button
+ Text { id: actionText; anchors.centerIn: parent; width: Math.max(0, parent.width - Style.space(24)); horizontalAlignment: Text.AlignHCenter; elide: Text.ElideRight; text: action.label; color: root.foreground; font.family: Style.font.family; font.pixelSize: Style.font.body; textFormat: Text.PlainText }
+ MouseArea { id: actionTouch; anchors.fill: parent; onClicked: action.tapped() }
+ }
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.leftMargin: Math.min(Style.space(24), root.width / 8)
+ anchors.rightMargin: anchors.leftMargin
+ anchors.topMargin: Style.space(root.height < 400 ? 8 : 12)
+ anchors.bottomMargin: Style.space(root.height < 400 ? 8 : 16)
+ spacing: Style.space(root.height < 400 ? 8 : 16)
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.preferredHeight: root.touch
+ Layout.maximumHeight: root.touch
+ spacing: Style.spacing.lg
+ Action { objectName: "agentBack"; label: "‹"; Accessible.name: "Back to search"; onTapped: root.backRequested() }
+ Text { Layout.fillWidth: true; text: root.agentName; textFormat: Text.PlainText; color: root.foreground; font.family: Style.font.family; font.pixelSize: Style.font.title; font.bold: true; elide: Text.ElideRight; Accessible.name: "Choose agent"; Accessible.role: Accessible.Button; MouseArea { anchors.fill: parent; enabled: !root.controller || !root.controller.busy; onClicked: root.chooseAgentRequested() } }
+ Action { objectName: "agentClose"; label: "×"; Accessible.name: "Close search"; onTapped: root.closeRequested() }
+ }
+ ListView {
+ id: history
+ objectName: "agentMessages"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.minimumHeight: 0
+ clip: true
+ spacing: Style.space(16)
+ model: root.controller ? root.controller.messages : []
+ boundsBehavior: Flickable.StopAtBounds
+ onCountChanged: Qt.callLater(function() { history.positionViewAtEnd() })
+ Connections { target: root.controller; function onMessagesChanged() { if (history.atYEnd || root.controller.busy) Qt.callLater(function() { history.positionViewAtEnd() }) } }
+ delegate: Item {
+ required property var modelData
+ width: history.width
+ height: bubble.height
+ Rectangle {
+ id: bubble
+ anchors.right: modelData.role === "user" ? parent.right : undefined
+ anchors.left: modelData.role !== "user" ? parent.left : undefined
+ width: modelData.role === "user" ? Math.min(Style.space(290), parent.width * 0.85) : parent.width
+ height: message.implicitHeight + Style.space(32)
+ radius: Style.cornerRadius
+ color: modelData.role === "user" ? root.cardColor : "transparent"
+ Text {
+ id: message
+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: Style.space(16) }
+ text: modelData.text
+ textFormat: Text.PlainText
+ wrapMode: Text.Wrap
+ color: root.foreground
+ font.family: Style.font.family
+ font.pixelSize: Style.font.subtitle
+ }
+ }
+ }
+ Text {
+ parent: history
+ anchors.centerIn: parent
+ width: parent.width
+ visible: !root.controller || root.controller.messages.length === 0
+ text: "Ask " + root.agentName + "\nYour draft stays editable. Send when you are ready."
+ textFormat: Text.PlainText
+ horizontalAlignment: Text.AlignHCenter
+ wrapMode: Text.Wrap
+ color: root.muted
+ font.family: Style.font.family
+ font.pixelSize: Style.font.body
+ }
+ }
+ Text {
+ objectName: "agentStatus"
+ Layout.fillWidth: true
+ visible: root.controller && (root.controller.busy || root.controller.resetPending || root.controller.error || !root.controller.capabilityKnown || !root.controller.available)
+ text: !root.controller ? "" : root.controller.error || (root.controller.resetPending ? "Resetting conversation…" : root.controller.stoppingId ? "Stopping…" : root.controller.busy ? "Working…" : !root.controller.capabilityKnown ? "Checking agent…" : root.controller.reason || "Native conversation is unavailable for this agent. Continue in its terminal app.")
+ textFormat: Text.PlainText
+ wrapMode: Text.Wrap
+ color: root.muted
+ font.family: Style.font.family
+ font.pixelSize: Style.font.body
+ }
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: composerLayout.implicitHeight + Style.space(24)
+ radius: Style.cornerRadius
+ color: root.cardColor
+ ColumnLayout {
+ id: composerLayout
+ anchors.fill: parent
+ anchors.margins: Style.space(12)
+ spacing: Style.spacing.sm
+ Controls.TextArea {
+ id: composer
+ objectName: "agentDraft"
+ Layout.fillWidth: true
+ Layout.preferredHeight: Math.max(root.touch, Math.min(Style.space(root.height < 400 ? 44 : 108), contentHeight + Style.space(16)))
+ clip: true
+ padding: Style.spacing.lg
+ background: null
+ onTextChanged: if (root.draft !== text) root.draft = text
+ placeholderText: "Message " + root.agentName
+ placeholderTextColor: root.muted
+ color: root.foreground
+ selectionColor: Commons.Color.accent
+ font.family: Style.font.family
+ font.pixelSize: Style.font.body
+ wrapMode: TextEdit.Wrap
+ Accessible.name: "Message " + root.agentName
+ Keys.onPressed: function(event) {
+ if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && (event.modifiers & Qt.ControlModifier)) {
+ if (root.controller && !root.controller.busy && root.controller.available) root.sendRequested(text)
+ event.accepted = true
+ }
+ }
+ }
+ RowLayout {
+ Layout.fillWidth: true
+ spacing: Style.spacing.lg
+ Action { label: root.width >= Style.space(360) ? "New chat" : "+"; Accessible.name: "New chat"; enabled: !root.controller || !root.controller.busy; onTapped: root.newChatRequested() }
+ Item { Layout.fillWidth: true }
+ Action {
+ objectName: "agentSend"
+ label: root.controller && root.controller.busy ? "Stop" : root.controller && root.controller.capabilityKnown && !root.controller.available ? "Open in terminal" : "Send →"
+ enabled: root.controller && !root.controller.stoppingId && (root.controller.busy || !root.controller.resetPending && root.controller.capabilityKnown && root.draft.trim().length > 0)
+ onTapped: {
+ if (root.controller.busy) root.controller.cancel()
+ else if (!root.controller.available) root.handoffRequested(root.draft)
+ else root.sendRequested(root.draft)
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/AppsSearch.qml b/packages/omamobile-shell/plugins/omamobile.launcher/AppsSearch.qml
new file mode 100644
index 000000000..51db64d57
--- /dev/null
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/AppsSearch.qml
@@ -0,0 +1,411 @@
+// SPDX-License-Identifier: MIT
+import QtQuick
+import QtQuick.Window
+import QtQuick.Layouts
+import qs.Commons
+import qs.Commons as Commons
+import qs.Ui
+
+// Search retains Omarchy's app catalog and an explicitly opened conversation.
+// No authentication, private widget, file index or voice adapter is included.
+Item {
+ id: root
+ objectName: "appsSearch"
+
+ property var appLibrary: null
+ property string agentId: ""
+ property string agentName: "Agent"
+ property string page: "search"
+ property bool chatStarted: false
+ property bool chatTransportEnabled: true
+ readonly property var chatController: chat
+ signal chooseAgent()
+ signal handoffAgent(string prompt)
+ function activeInput() { return page === "agent" ? conversation.inputField : input }
+ function focusPage() {
+ ++focusGeneration
+ focusPending = true
+ queueFocus()
+ }
+ function openAgent() {
+ if (!opened || sessionLocked) return
+ if (!agentId) { chooseAgent(); return }
+ if (!conversation.draft && query.trim()) conversation.draft = query
+ input.focus = false
+ chatStarted = true
+ chat.ensureStarted()
+ page = "agent"
+ focusPage()
+ }
+ function back() {
+ if (page === "agent") {
+ chat.cancel()
+ conversation.inputField.focus = false
+ page = "search"
+ focusPage()
+ } else dismiss()
+ }
+ function sendAgent(text) {
+ if (opened && !sessionLocked && page === "agent") chat.send(text)
+ }
+ AgentChatController {
+ id: chat
+ provider: root.agentId
+ enabled: root.chatStarted
+ transportEnabled: root.chatTransportEnabled
+ onAccepted: function(prompt) { if (conversation.draft.trim() === prompt) conversation.draft = "" }
+ }
+ property bool paintBackground: true
+ property bool opened: false
+ property bool sessionLocked: false
+ onSessionLockedChanged: if (sessionLocked) dismiss()
+ property string query: ""
+ property var entries: []
+ property bool surfaceActive: root.Window.active
+ property bool inputReady: true
+ property int focusGeneration: 0
+ property bool focusPending: false
+ property bool hadFocus: false
+ property int transitionDuration: typeof Style.duration === "function" ? Style.duration(140) : 140
+ readonly property color foreground: Commons.Color.menu.text
+ readonly property int touch: Math.max(44, Style.space(44))
+ signal dismissed()
+ signal activated(var entry)
+ // Also useful to the offscreen harness: this observes the production input
+ // context request, not a pretend keyboard or a global visibility policy.
+ signal inputRequested(bool visible)
+
+ opacity: opened ? 1 : 0
+ enabled: opened
+ Behavior on opacity { NumberAnimation { duration: root.transitionDuration; easing.type: Easing.OutCubic } }
+
+ function refreshEntries() {
+ if (!opened) return
+ var ranked = appLibrary ? appLibrary.sortedEntries(query) : []
+ var next = []
+ var limit = query.trim() ? 40 : 3
+ for (var i = 0; i < ranked.length && next.length < limit; i++)
+ if (ranked[i] && ranked[i].entry) next.push(ranked[i].entry)
+ var same = next.length === entries.length
+ for (var j = 0; same && j < next.length; j++) same = next[j] === entries[j]
+ if (!same) entries = next
+ }
+ function name(entry) {
+ return appLibrary && typeof appLibrary.entryName === "function"
+ ? appLibrary.entryName(entry) : String(entry && entry.name || "")
+ }
+ function icon(entry) {
+ return appLibrary && typeof appLibrary.iconSource === "function"
+ ? appLibrary.iconSource(entry.icon) : ""
+ }
+ function queueFocus() {
+ if (sessionLocked || !opened || !focusPending || !surfaceActive || !inputReady) return
+ var generation = focusGeneration
+ Qt.callLater(function() {
+ if (root.sessionLocked || !root.opened || !root.focusPending || !root.surfaceActive || !root.inputReady || generation !== root.focusGeneration) return
+ root.focusPending = false
+ root.activeInput().forceActiveFocus()
+ root.hadFocus = true
+ Qt.inputMethod.show()
+ root.inputRequested(true)
+ })
+ }
+ function open(text) {
+ if (sessionLocked) { close(); return }
+ ++focusGeneration
+ query = String(text || "").slice(0, 256)
+ opened = true
+ hadFocus = false
+ focusPending = true
+ refreshEntries()
+ queueFocus()
+ }
+ function close() {
+ ++focusGeneration
+ focusPending = false
+ // Never hide a different app's or the lock screen's input context after
+ // focus has already moved there. Clearing our field still releases it.
+ chat.cancel()
+ if ((input.activeFocus || conversation.inputField.activeFocus) && surfaceActive) {
+ Qt.inputMethod.hide()
+ inputRequested(false)
+ }
+ input.focus = false
+ conversation.inputField.focus = false
+ if (surfaceActive) root.forceActiveFocus()
+ hadFocus = false
+ opened = false
+ }
+ function dismiss() { close(); dismissed() }
+ function activate(entry) {
+ if (!entry || !entry.id) return
+ close() // release our input context before an app can take focus
+ activated(entry)
+ }
+ function activateFirst() { if (entries.length) activate(entries[0]) }
+ onQueryChanged: refreshEntries()
+ onAppLibraryChanged: refreshEntries()
+ onInputReadyChanged: queueFocus()
+ onSurfaceActiveChanged: {
+ if (!opened) return
+ if (surfaceActive) queueFocus()
+ else if (hadFocus) dismiss()
+ }
+ Connections {
+ target: root.appLibrary
+ ignoreUnknownSignals: true
+ function onAppsChanged() { root.refreshEntries() }
+ }
+
+ onOpacityChanged: if (opacity === 0 && !opened) { query = ""; entries = [] }
+ // The phone's Search layout: a top composer, then compact borderless
+ // app rows. Glass is a tint, never a live client-side wallpaper effect.
+ readonly property color backgroundTone: Commons.Color.menu.background
+ readonly property real backdropAlpha: typeof Style.styleAlpha === "function" ? Style.styleAlpha("mobile-search-backdrop-alpha", 0.92) : 0.92
+ readonly property real cardAlpha: typeof Style.styleAlpha === "function" ? Style.styleAlpha("mobile-search-card-alpha", 0.94) : 0.94
+ readonly property color backdropColor: Qt.rgba(backgroundTone.r, backgroundTone.g, backgroundTone.b, backdropAlpha)
+ readonly property color secondary: Qt.tint(backgroundTone, Qt.rgba(foreground.r, foreground.g, foreground.b, 0.72))
+ readonly property color muted: Qt.tint(backgroundTone, Qt.rgba(foreground.r, foreground.g, foreground.b, 0.60))
+ readonly property color cardTone: Qt.tint(backgroundTone, Qt.rgba(foreground.r, foreground.g, foreground.b, 0.06))
+ readonly property color cardColor: Qt.rgba(cardTone.r, cardTone.g, cardTone.b, cardAlpha)
+ function glyph(name, ink) {
+ var paths = {
+ close: '',
+ search: '',
+ spark: '',
+ chevron: ''
+ }
+ return "data:image/svg+xml," + encodeURIComponent('')
+ }
+ Rectangle { anchors.fill: parent; visible: root.paintBackground; color: root.backdropColor }
+ ColumnLayout {
+ visible: root.page === "search"
+ anchors.fill: parent
+ anchors.leftMargin: Math.min(Style.space(24), root.width / 8)
+ anchors.rightMargin: anchors.leftMargin
+ anchors.topMargin: Math.min(Style.space(12), Math.max(0, (root.height - root.touch) / 4))
+ anchors.bottomMargin: Math.min(Style.space(16), Math.max(0, (root.height - root.touch) / 4))
+ spacing: 0
+
+ RowLayout {
+ objectName: "searchHeader"
+ Layout.fillWidth: true
+ Layout.minimumHeight: Math.min(root.touch, root.height)
+ Layout.maximumHeight: Layout.preferredHeight
+ Layout.preferredHeight: Math.min(Style.space(56), Math.max(root.touch, root.height))
+ spacing: Style.spacing.lg
+ Item {
+ objectName: "searchClose"
+ Layout.preferredWidth: root.touch
+ Layout.fillHeight: true
+ Accessible.name: "Close search"
+ Accessible.role: Accessible.Button
+ Image { anchors.centerIn: parent; width: Style.space(24); height: width; source: root.glyph("close", root.foreground) }
+ MouseArea { anchors.fill: parent; onClicked: root.dismiss() }
+ }
+ BorderSurface {
+ objectName: "searchInputSurface"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ radius: Style.cornerRadius
+ color: root.cardColor
+ borderSpec: Border.controlSpec(input.activeFocus ? "focus" : "normal", root.foreground, Commons.Color.accent)
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: Style.space(16)
+ anchors.rightMargin: Style.spacing.sm
+ spacing: Style.spacing.xxl
+ Image { Layout.preferredWidth: Style.space(20); Layout.preferredHeight: width; source: root.glyph("search", root.secondary) }
+ TextField {
+ id: input
+ objectName: "appsSearchInput"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ background: null
+ padding: 0
+ text: root.query
+ placeholderText: "Search apps"
+ foreground: root.foreground
+ placeholderTextColor: root.muted
+ font.family: Style.font.family
+ font.pixelSize: Style.font.title
+ maximumLength: 256
+ selectByMouse: true
+ Accessible.name: "Search apps"
+ onTextEdited: root.query = text
+ Keys.onReturnPressed: root.activateFirst()
+ Keys.onEnterPressed: root.activateFirst()
+ Keys.onEscapePressed: root.back()
+ }
+ Item {
+ objectName: "searchClear"
+ visible: root.query.length > 0
+ Layout.preferredWidth: root.touch
+ Layout.fillHeight: true
+ Accessible.name: "Clear search"
+ Accessible.role: Accessible.Button
+ Image { anchors.centerIn: parent; width: Style.space(20); height: width; source: root.glyph("close", root.secondary) }
+ MouseArea { anchors.fill: parent; onClicked: { root.query = ""; input.forceActiveFocus() } }
+ }
+ }
+ }
+ }
+
+ Item { Layout.fillWidth: true; Layout.preferredHeight: root.height >= Style.space(180) ? Style.space(28) : 0 }
+ Text {
+ visible: root.entries.length > 0 && root.height >= Style.space(180)
+ Layout.fillWidth: true
+ Layout.bottomMargin: Style.spacing.xxl
+ text: "Apps"
+ color: root.secondary
+ font.family: Style.font.family
+ font.pixelSize: Style.font.body
+ font.bold: true
+ }
+ ListView {
+ id: results
+ objectName: "searchResults"
+ visible: root.height >= Style.space(180)
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.minimumHeight: 0
+ clip: true
+ spacing: 0
+ model: root.entries
+ boundsBehavior: Flickable.StopAtBounds
+ delegate: Item {
+ required property var modelData
+ required property int index
+ objectName: "searchResult" + index
+ width: results.width
+ height: Math.max(root.touch, Style.space(68))
+ Accessible.name: root.name(modelData)
+ Accessible.role: Accessible.Button
+ Rectangle { anchors.fill: parent; radius: Style.cornerRadius; color: rowTouch.pressed ? Style.pressedFillFor(root.foreground, Commons.Color.accent) : "transparent" }
+ RowLayout {
+ anchors.fill: parent
+ spacing: Style.space(14)
+ Rectangle {
+ Layout.preferredWidth: root.touch
+ Layout.preferredHeight: root.touch
+ radius: Style.cornerRadius
+ color: root.cardColor
+ Image { id: appIcon; anchors.centerIn: parent; width: Style.space(32); height: width; source: root.icon(modelData); fillMode: Image.PreserveAspectFit }
+ Text { anchors.centerIn: parent; visible: appIcon.status !== Image.Ready; text: root.name(modelData).slice(0, 1); textFormat: Text.PlainText; color: Commons.Color.accent; font.family: Style.font.family; font.pixelSize: Style.font.title }
+ }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: Style.spacing.xs
+ Text {
+ Layout.fillWidth: true
+ text: root.name(modelData)
+ textFormat: Text.PlainText
+ color: root.foreground
+ font.family: Style.font.family
+ font.pixelSize: (typeof Style.font.heading === "number" ? Style.font.heading : Style.font.title)
+ font.bold: true
+ elide: Text.ElideRight
+ }
+ Text {
+ Layout.fillWidth: true
+ text: String(modelData.genericName || modelData.comment || "Application")
+ textFormat: Text.PlainText
+ color: root.muted
+ font.family: Style.font.family
+ font.pixelSize: Style.font.body
+ elide: Text.ElideRight
+ }
+ }
+ Image { Layout.preferredWidth: Style.space(18); Layout.preferredHeight: width; source: root.glyph("chevron", root.muted) }
+ }
+ MouseArea { id: rowTouch; anchors.fill: parent; onClicked: root.activate(modelData) }
+ }
+ footer: Item {
+ width: results.width
+ height: root.height >= Style.space(280) ? Style.space(108) : 0
+ visible: height > 0
+ Rectangle {
+ anchors { left: parent.left; right: parent.right; top: parent.top; topMargin: Style.space(20) }
+ height: Style.space(88)
+ radius: Style.cornerRadius
+ color: root.cardColor
+ objectName: "askAgentCard"
+ Accessible.name: root.agentId ? "Ask " + root.agentName : "Choose an agent"
+ Accessible.role: Accessible.Button
+ RowLayout {
+ anchors.fill: parent
+ anchors.margins: Style.space(16)
+ spacing: Style.space(14)
+ Image { Layout.preferredWidth: Style.space(24); Layout.preferredHeight: width; source: root.glyph("spark", Commons.Color.accent) }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: Style.spacing.sm
+ Text { Layout.fillWidth: true; text: root.agentId ? "Ask " + root.agentName : "Choose an agent"; textFormat: Text.PlainText; color: root.foreground; font.family: Style.font.family; font.pixelSize: Style.font.subtitle; font.bold: true; elide: Text.ElideRight }
+ Text { Layout.fillWidth: true; text: "Start a conversation"; color: root.muted; font.family: Style.font.family; font.pixelSize: Style.font.body }
+ }
+ Image { Layout.preferredWidth: Style.space(18); Layout.preferredHeight: width; source: root.glyph("chevron", root.secondary) }
+ }
+ MouseArea { anchors.fill: parent; onClicked: root.openAgent() }
+ }
+ }
+ // Translucent fades follow the glass tint without an opaque edge band.
+ Rectangle {
+ parent: results
+ anchors { left: parent.left; right: parent.right; top: parent.top }
+ height: Math.min(Style.spacing.lg, results.height)
+ visible: !results.atYBeginning
+ z: 1
+ gradient: Gradient {
+ GradientStop { position: 0; color: root.backdropColor }
+ GradientStop { position: 1; color: Qt.rgba(root.backgroundTone.r, root.backgroundTone.g, root.backgroundTone.b, 0) }
+ }
+ }
+ Rectangle {
+ parent: results
+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
+ height: Math.min(Style.spacing.lg, results.height)
+ visible: !results.atYEnd
+ z: 1
+ gradient: Gradient {
+ GradientStop { position: 0; color: Qt.rgba(root.backgroundTone.r, root.backgroundTone.g, root.backgroundTone.b, 0) }
+ GradientStop { position: 1; color: root.backdropColor }
+ }
+ }
+ header: Item {
+ width: results.width
+ height: emptyLabel.visible ? emptyLabel.implicitHeight + Style.space(20) : 0
+ Text {
+ id: emptyLabel
+ objectName: "searchEmpty"
+ width: parent.width
+ visible: root.entries.length === 0
+ text: root.appLibrary ? "No apps found" : "Loading apps…"
+ textFormat: Text.PlainText
+ wrapMode: Text.Wrap
+ color: root.secondary
+ font.family: Style.font.family
+ font.pixelSize: Style.font.body
+ }
+ }
+ }
+ Item { visible: !results.visible; Layout.fillHeight: true }
+ }
+ AgentConversation {
+ id: conversation
+ anchors.fill: parent
+ visible: root.page === "agent"
+ controller: chat
+ agentName: root.agentName
+ foreground: root.foreground
+ muted: root.muted
+ cardColor: root.cardColor
+ onBackRequested: root.back()
+ onCloseRequested: root.dismiss()
+ onSendRequested: function(prompt) { root.sendAgent(prompt) }
+ onHandoffRequested: function(prompt) { root.close(); root.handoffAgent(prompt) }
+ onChooseAgentRequested: root.chooseAgent()
+ onNewChatRequested: { chat.reset(); conversation.draft = ""; root.focusPage() }
+ }
+ Keys.onEscapePressed: root.back()
+ Keys.onBackPressed: root.back()
+}
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/AppsSearchLink.js b/packages/omamobile-shell/plugins/omamobile.launcher/AppsSearchLink.js
new file mode 100644
index 000000000..935ad5eb3
--- /dev/null
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/AppsSearchLink.js
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: MIT
+.pragma library
+
+// Native panels share one registry in the shell's QML engine. Back can close
+// Search even before its OnDemand window has received keyboard focus.
+var controller = null
+
+function publish(value) { controller = value }
+function clear(value) { if (controller === value) controller = null }
+function close() {
+ if (!controller || !controller.searchOpened) return false
+ controller.closeSearch()
+ return true
+}
+
+// System Back may step out of the conversation. Home always calls close().
+function back() {
+ if (!controller || !controller.searchOpened) return false
+ if (typeof controller.backSearch === "function") controller.backSearch()
+ else controller.closeSearch()
+ return true
+}
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml b/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml
index 8ccbb3505..0439de0e6 100644
--- a/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml
@@ -11,12 +11,13 @@ import qs.services as OmarchyServices
import "LauncherModel.js" as LauncherModel
import "Readable.js" as Readable
import "DrawerLink.js" as DrawerLink
+import "AppsSearchLink.js" as AppsSearchLink
// The phone's home surface, after Omalauncher: one bar at the bottom of the
-// screen that is app search, app grid and coding-agent prompt at once.
+// screen. Dock tap opens native app Search; swiping opens the App Library.
//
-// Collapsed, it is a dock holding a single search pill. Tapping it raises the
-// app drawer with the input focused. Typing filters the grid; text that reads
+// The App Library retains its existing search and optional agent flow.
+// Typing there filters the grid; text that reads
// like a sentence (or matches no app) offers "Ask " (the user's
// Omarchy default agent) instead, and Enter
// takes whichever is on top: the first app, or a terminal running the agent
@@ -50,6 +51,7 @@ Item {
}
// `opened` is the drawer; the dock is always on screen.
+ readonly property bool searchOpened: appsSearch.opened
property bool opened: false
property string query: ""
property var apps: []
@@ -194,6 +196,13 @@ Item {
function open(payloadJson) {
var payload = ({})
try { payload = JSON.parse(payloadJson || "{}") } catch (e) { payload = ({}) }
+ if (payload.view === "apps-search") {
+ if (sessionLocked) { appsSearch.close(); return }
+ if (opened) close()
+ appsSearch.open(payload.query)
+ return
+ }
+ appsSearch.close()
var gesture = payload.gesture === true
query = typeof payload.query === "string" ? payload.query : ""
refreshApps()
@@ -209,6 +218,7 @@ Item {
// A closing drawer never holds a focused text field: the field gives the
// focus back first, so nothing asks for the keyboard as the drawer goes.
function close() {
+ appsSearch.close()
if (input.activeFocus) sheet.forceActiveFocus()
opened = false
query = ""
@@ -224,6 +234,25 @@ Item {
else close()
}
+ // Explicit dock activation is distinct from the swipe App Library.
+ function activateDock() {
+ if (settings.nativeSearch === false) expand()
+ else openSearch("")
+ }
+ function openSearch(text) {
+ if (sessionLocked) return
+ var payload = JSON.stringify({ view: "apps-search", query: String(text || "") })
+ if (shell && typeof shell.summon === "function") shell.summon(pluginId, payload)
+ else open(payload)
+ }
+ function backSearch() {
+ appsSearch.back()
+ }
+ function closeSearch() {
+ appsSearch.close()
+ dismiss(0)
+ }
+
function expand() {
if (shell && typeof shell.summon === "function") shell.summon(pluginId, "{}")
else open("{}")
@@ -240,10 +269,12 @@ Item {
function state() {
return JSON.stringify({
+ searchOpened: searchOpened,
opened: opened,
- query: query,
- mode: hasQuery ? (promptMode ? "agent" : "apps") : "idle",
- apps: apps.length,
+ view: searchOpened ? "search" : opened ? "library" : "home",
+ query: searchOpened ? appsSearch.query : query,
+ mode: searchOpened ? "apps" : hasQuery ? (promptMode ? "agent" : "apps") : "idle",
+ apps: searchOpened ? appsSearch.entries.length : apps.length,
library: shell && shell.appLibrary ? "host" : (appLibrary ? "local" : "none"),
agent: agentId,
command: hasAgent ? LauncherModel.promptArgv("") : LauncherModel.PICK_AGENT_ARGV
@@ -255,7 +286,7 @@ Item {
Connections {
target: Hyprland
function onRawEvent(event) {
- if (root.opened && event && event.name === "openwindow") root.dismiss()
+ if ((root.opened || root.searchOpened) && event && event.name === "openwindow") root.dismiss()
}
}
@@ -373,7 +404,7 @@ Item {
// decides there whether it opens (LauncherModel.drawerEndsOpen: a fling,
// or a quarter of the way) and then opens through the host, as a tap does.
function gestureBegin() {
- if (opened) return false
+ if (opened || searchOpened) return false
settle.stop()
pulling = false
homeSwipe = true
@@ -450,7 +481,7 @@ Item {
anchors.fill: parent
anchors.margins: Style.spacing.xxl
placeholder: (root.hasAgent ? "Search apps or ask " + root.agentName + "…" : "Search apps…")
- onTapped: root.expand()
+ onTapped: root.activateDock()
// Hold: the voice bar, as a hold on the pill over an app.
onHeld: root.voiceHold()
}
@@ -567,6 +598,8 @@ Item {
}
function goHome() {
+ if (searchOpened) closeSearch()
+
// As the switcher's Home: an empty workspace, then the home page.
Quickshell.execDetached(["hyprctl", "dispatch", "hl.dsp.focus({ workspace = \"empty\" })"])
Quickshell.execDetached(["qs", "ipc", "-p", Quickshell.shellDir, "call", "shell", "call", "omamobile.home", "goHome", ""])
@@ -637,6 +670,7 @@ Item {
}
function showRecents() {
+ if (searchOpened) closeSearch()
// Through the CLI, like the dock's swipe: a plugin may only summon
// panels it owns, and the switcher is its own plugin.
Quickshell.execDetached(["omarchy-shell", "shell", "summon", "omamobile.switcher", "{}"])
@@ -671,7 +705,7 @@ Item {
// While the keyboard is up the strip shows on the home screen too, and
// over the open drawer (its search field): the keyboard covers the dock
// there, and with it the swipe up to the drawer.
- readonly property bool stripShown: (appOnScreen || oskOpen) && (!opened || oskOpen) && !fullscreenOnScreen && !(oskOpen && sessionLocked)
+ readonly property bool stripShown: (appOnScreen || oskOpen || searchOpened) && (!opened || oskOpen) && !fullscreenOnScreen && !(oskOpen && sessionLocked)
readonly property bool keyboardStripShown: stripShown && oskOpen
Process {
@@ -1094,6 +1128,64 @@ Item {
}
}
+ // Both surfaces remain mapped: opening does not wait for a new Wayland
+ // configure or expose the drawer for a frame. Only content takes input.
+ PanelWindow {
+ visible: true
+ anchors { top: true; bottom: true; left: true; right: true }
+ exclusionMode: ExclusionMode.Ignore
+ color: "transparent"
+ mask: Region { item: null }
+ Rectangle {
+ anchors.fill: parent
+ // Keep the existing Home strip visible and reachable, even after the
+ // keyboard is manually hidden. The content window respects its zone.
+ anchors.bottomMargin: root.stripHeight
+ color: appsSearch.backdropColor
+ visible: appsSearch.opacity > 0
+ opacity: appsSearch.opacity
+ }
+ WlrLayershell.namespace: "omamobile-app-search-background"
+ WlrLayershell.layer: WlrLayer.Top
+ WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
+ }
+ PanelWindow {
+ visible: true
+ anchors { top: true; bottom: true; left: true; right: true }
+ exclusionMode: ExclusionMode.Normal
+ color: "transparent"
+ mask: Region { item: root.searchOpened ? appsSearch : null }
+ id: searchWindow
+ WlrLayershell.namespace: "omamobile-app-search"
+ WlrLayershell.layer: WlrLayer.Top
+ // Prime native focus briefly, then release exclusive pointer routing so
+ // the OSK and the existing Home/Back surfaces receive their own touches.
+ WlrLayershell.keyboardFocus: searchFocus.mode === "none" ? WlrKeyboardFocus.None
+ : searchFocus.mode === "exclusive" ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.OnDemand
+ SearchFocus {
+ id: searchFocus
+ opened: root.searchOpened
+ requestGeneration: appsSearch.focusGeneration
+ backingWindowVisible: searchWindow.backingWindowVisible
+ }
+ AppsSearch {
+ id: appsSearch
+ anchors.fill: parent
+ appLibrary: root.appLibrary
+ agentId: root.agentId
+ agentName: root.agentName
+ onChooseAgent: { root.closeSearch(); Util.execArgv(LauncherModel.PICK_AGENT_ARGV) }
+ onHandoffAgent: function(prompt) { root.askAgent(prompt) }
+ sessionLocked: root.sessionLocked
+ paintBackground: false // backdrop paints the theme alpha once, also over the bar
+ inputReady: searchFocus.inputReady
+ Component.onCompleted: AppsSearchLink.publish(root)
+ Component.onDestruction: AppsSearchLink.clear(root)
+ onDismissed: root.dismiss(0)
+ onActivated: function(entry) { root.launchApp(entry) }
+ }
+ }
+
// ---------------------------------------------------------------- parts
// The collapsed bar: looks like the input it turns into.
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/SearchFocus.qml b/packages/omamobile-shell/plugins/omamobile.launcher/SearchFocus.qml
new file mode 100644
index 000000000..892d976cd
--- /dev/null
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/SearchFocus.qml
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) David Heinemeier Hansson
+import QtQuick
+
+// Focus prime adapted from Omarchy's Ui/KeyboardPanel.qml (MIT), present in
+// both supported Omarchy families. See LICENSE.omarchy. OnDemand alone cannot
+// acquire focus when an already-mapped Search window is opened again.
+QtObject {
+ id: root
+ property bool opened: false
+ property bool backingWindowVisible: false
+ property bool focusPrimed: false
+ property int requestGeneration: 0
+ onRequestGenerationChanged: {
+ if (opened) { focusPrimed = false; beginFocusPrime() }
+ }
+ readonly property string mode: !opened ? "none" : focusPrimed ? "on-demand" : "exclusive"
+ readonly property bool inputReady: opened && backingWindowVisible && focusPrimed
+ function beginFocusPrime() {
+ if (opened && backingWindowVisible) focusPrimeTimer.restart()
+ }
+ onBackingWindowVisibleChanged: beginFocusPrime()
+ onOpenedChanged: {
+ focusPrimed = false
+ if (opened) beginFocusPrime()
+ else focusPrimeTimer.stop()
+ }
+ property Timer focusPrimeTimer: Timer {
+ interval: 75
+ onTriggered: if (root.opened) root.focusPrimed = true
+ }
+}
diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/manifest.json b/packages/omamobile-shell/plugins/omamobile.launcher/manifest.json
index 99fac63c4..1d9f6bc0d 100644
--- a/packages/omamobile-shell/plugins/omamobile.launcher/manifest.json
+++ b/packages/omamobile-shell/plugins/omamobile.launcher/manifest.json
@@ -5,7 +5,7 @@
"version": "0.1.0",
"author": "Omarchy Mobile",
"license": "MIT",
- "description": "The phone's home bar: one input at the bottom of the screen that searches apps, opens the app grid and sends a prompt to your coding agent.",
+ "description": "The phone home bar: native app search on tap, App Library on swipe, and the Home indicator.",
"kinds": [
"panel"
],
@@ -16,7 +16,8 @@
"settings": {
"defaults": {
"columns": 4,
- "sentenceWords": 3
+ "sentenceWords": 3,
+ "nativeSearch": true
},
"schema": [
{
@@ -32,6 +33,11 @@
"label": "Words that make a prompt",
"min": 2,
"max": 8
+ },
+ {
+ "key": "nativeSearch",
+ "type": "boolean",
+ "label": "Use separate app search on dock tap"
}
]
}
diff --git a/packages/omamobile-shell/test/agent-chat-ui.py b/packages/omamobile-shell/test/agent-chat-ui.py
new file mode 100644
index 000000000..de78e7158
--- /dev/null
+++ b/packages/omamobile-shell/test/agent-chat-ui.py
@@ -0,0 +1,117 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: MIT
+"""Real QML controller -> real Python server -> inert CLI; no account/client calls."""
+from pathlib import Path
+import json, os, shutil, subprocess, tempfile
+
+PKG = Path(__file__).resolve().parent.parent
+FAKE = '''#!/usr/bin/python3
+import json,os,sys,time
+prompt=sys.stdin.read()
+with open(os.environ['FIXTURE_CALLS'],'a') as stream: stream.write(json.dumps({'argv':sys.argv[1:],'prompt':prompt,'home':os.environ.get('CODEX_HOME')})+'\\n')
+if prompt=='wait until cancelled': time.sleep(30)
+if prompt=='fail after prior turn':
+ print(json.dumps({'type':'turn.failed','error':{'message':'401 authentication PRIVATE_FIXTURE_DIAGNOSTIC'}}),flush=True);sys.exit(1)
+print(json.dumps({'type':'thread.started','thread_id':'fixture-thread'}),flush=True)
+print(json.dumps({'type':'item.completed','item':{'type':'agent_message','text':'Reply: '+prompt}}),flush=True)
+print(json.dumps({'type':'turn.completed'}),flush=True)
+'''
+QML = '''import QtQuick
+import QtTest
+import Quickshell
+import Quickshell.Io
+ShellRoot {
+ AgentChatController { id: chat; provider: "codex"; enabled: true }
+ SignalSpy { id: accepted; target: chat; signalName: "accepted" }
+ FileView { id: account; path: Quickshell.env("FIXTURE_ACCOUNT_FILE"); atomicWrites: true }
+ FileView { id: selection; path: Quickshell.env("FIXTURE_PROVIDER_FILE"); atomicWrites: true }
+ TestCase {
+ name: "AgentControllerRealTransport"
+ when: true
+ function initTestCase() { qtest_results.startLogging(); wait(100); console.log("TRANSPORT_INITIAL",chat.capabilityKnown,chat.available,chat.resetPending,chat.error); tryCompare(chat,"capabilityKnown",true,4000); verify(chat.available) }
+ function test_real_transport_reply_resume_account_reset_and_cancellation() {
+ verify(chat.send("first editable request")); tryCompare(chat,"busy",false,4000)
+ compare(accepted.count,1); compare(chat.messages[1].text,"Reply: first editable request")
+ verify(chat.send("second request")); tryCompare(chat,"busy",false,4000)
+ compare(accepted.count,2); compare(chat.messages[3].text,"Reply: second request")
+ verify(chat.send("fail after prior turn"));tryCompare(chat,"busy",false,4000)
+ compare(accepted.count,3)
+ verify(chat.error.indexOf("Sign in")>=0)
+ verify(chat.error.indexOf("PRIVATE_FIXTURE_DIAGNOSTIC")<0)
+ compare(chat.messages[1].text,"Reply: first editable request")
+ compare(chat.messages[3].text,"Reply: second request")
+ verify(chat.send("continue after structured failure"));tryCompare(chat,"busy",false,4000)
+ compare(chat.messages[7].text,"Reply: continue after structured failure")
+ compare(chat.messages[1].text,"Reply: first editable request")
+ account.setText("account-two"); wait(100)
+ verify(chat.send("changed account request")); tryCompare(chat,"busy",false,4000)
+ compare(chat.messages.length,2); compare(chat.messages[1].text,"Reply: changed account request")
+ var beforeCancel=accepted.count
+ verify(chat.send("wait until cancelled")); tryCompare(accepted,"count",beforeCancel+1,3000)
+ var oldId=chat.activeId
+ chat.reset(); verify(chat.resetPending); verify(!chat.send("must not race reset"))
+ tryCompare(chat,"resetPending",false,4000); tryCompare(chat,"available",true,3000)
+ compare(chat.messages.length,0)
+ chat.receive({type:"reply",id:oldId,text:"stale reply"}); compare(chat.messages.length,0)
+ verify(chat.send("after reset")); tryCompare(chat,"busy",false,4000)
+ compare(chat.messages[1].text,"Reply: after reset")
+ chat.process.signal(15)
+ tryCompare(chat,"processWanted",false,4000);verify(!chat.busy)
+ chat.reset() // explicit New chat restarts local serve, never model work
+ verify(chat.resetPending)
+ tryCompare(chat,"resetPending",false,4000);tryCompare(chat,"available",true,3000)
+ verify(chat.send("after local service restart"));tryCompare(chat,"busy",false,4000)
+ compare(chat.messages[1].text,"Reply: after local service restart")
+ selection.setText("claude\\n"); wait(100); chat.provider="claude"
+ tryCompare(chat,"resetPending",false,4000); tryCompare(chat,"capabilityKnown",true,3000)
+ verify(!chat.available); verify(!chat.send("unsupported provider"))
+ }
+ function cleanupTestCase() {
+ console.log("AGENT_TRANSPORT_RESULT",qtest_results.failCount,qtest_results.passCount)
+ chat.enabled=false
+ qtest_results.stopLogging(); Qt.quit()
+ }
+ }
+ Timer { interval:25000; running:true; onTriggered:Qt.quit() }
+}
+'''
+
+def main():
+ with tempfile.TemporaryDirectory(prefix='omamobile-agent-ui-') as directory:
+ root=Path(directory); home=root/'home'; home.mkdir(); bindir=root/'bin'; bindir.mkdir(); app=root/'app'; app.mkdir()
+ config=home/'.config/omarchy/defaults'; config.mkdir(parents=True); provider=config/'agent'; provider.write_text('codex\n')
+ account=root/'account'; account.write_text('account-one')
+ runtime=root/'run'; runtime.mkdir(mode=0o700)
+ shutil.copy(PKG/'plugins/omamobile.launcher/AgentChatController.qml', app/'AgentChatController.qml')
+ (app/'shell.qml').write_text(QML)
+ scripts={'codex':FAKE,'claude':'#!/bin/sh\nexit 0\n',
+ 'omarchy-agent-account-home':'#!/usr/bin/python3\nimport os\nfrom pathlib import Path\nprint(Path(os.environ["FIXTURE_ACCOUNT_FILE"]).read_text().strip())\n',
+ 'omamobile-agent-chat':'#!/usr/bin/python3\nimport sys\nsys.path.insert(0,'+repr(str(PKG/'lib'))+')\nfrom agent_chat import main\nraise SystemExit(main())\n'}
+ for name, source in scripts.items():
+ p=bindir/name; p.write_text(source); p.chmod(0o700)
+ env={'HOME':str(home),'PATH':str(bindir)+':/usr/bin:/bin','XDG_STATE_HOME':str(root/'state'),'XDG_RUNTIME_DIR':str(runtime),
+ 'QT_QPA_PLATFORM':'offscreen','QT_QUICK_BACKEND':'software','QML_DISABLE_DISK_CACHE':'1','QT_QUICK_CONTROLS_STYLE':'Basic',
+ 'DBUS_SESSION_BUS_ADDRESS':'unix:path=/nonexistent','DBUS_SYSTEM_BUS_ADDRESS':'unix:path=/nonexistent',
+ 'FIXTURE_CALLS':str(root/'calls'),'FIXTURE_ACCOUNT_FILE':str(account),'FIXTURE_PROVIDER_FILE':str(provider)}
+ result=subprocess.run(['/usr/bin/quickshell','--path',str(app/'shell.qml'),'--no-color'],env=env,capture_output=True,text=True,timeout=30)
+ output=result.stdout+result.stderr; print(output)
+ assert result.returncode==0 and 'AGENT_TRANSPORT_RESULT 0 2' in output
+ assert not any(x in output for x in ('ReferenceError:','TypeError:','Failed to load configuration'))
+ calls=[json.loads(line) for line in (root/'calls').read_text().splitlines()]
+ expected=['first editable request','second request','fail after prior turn','continue after structured failure','changed account request','wait until cancelled','after reset','after local service restart']
+ assert [call['prompt'] for call in calls]==expected, calls
+ by_prompt={call['prompt']:call for call in calls}
+ first=by_prompt['first editable request']
+ assert first['argv'][:3]==['exec','--sandbox','workspace-write']
+ assert 'resume' not in first['argv']
+ for prompt in ('second request','fail after prior turn','continue after structured failure'):
+ argv=by_prompt[prompt]['argv']
+ assert argv[3:5]==['resume','fixture-thread'], (prompt,argv)
+ changed=by_prompt['changed account request']
+ assert 'resume' not in changed['argv'] and changed['home']=='account-two'
+ assert 'resume' not in by_prompt['after reset']['argv']
+ assert 'resume' not in by_prompt['after local service restart']['argv']
+ assert all('--last' not in value['argv'] for value in calls)
+ print('PASS actual QML/Python/fake-CLI transport, accepted send, exact resume after structured failure, account/provider reset and cancellation')
+
+if __name__=='__main__': main()
diff --git a/packages/omamobile-shell/test/agent-chat.py b/packages/omamobile-shell/test/agent-chat.py
new file mode 100644
index 000000000..3359b8b77
--- /dev/null
+++ b/packages/omamobile-shell/test/agent-chat.py
@@ -0,0 +1,168 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: MIT
+"""Offline bridge fixtures: only inert temporary executables, never real agents."""
+import importlib.util
+import io
+import json
+import os
+from pathlib import Path
+import tempfile
+import time
+import unittest
+from unittest.mock import patch
+
+PKG = Path(__file__).resolve().parent.parent
+spec = importlib.util.spec_from_file_location('chat', PKG/'lib/agent_chat.py')
+chat = importlib.util.module_from_spec(spec); spec.loader.exec_module(chat)
+FAKE = '''#!/usr/bin/python3
+import json,os,sys,time
+if os.environ.get('FIXTURE_NO_READ')=='1':time.sleep(30)
+prompt=sys.stdin.read()
+with open(os.environ['FIXTURE_LOG'],'a') as f:f.write(json.dumps({'argv':sys.argv[1:],'prompt':prompt,'home':os.environ.get('CODEX_HOME'),'keep':os.environ.get('KEEP_ME'),'cwd':os.getcwd()})+'\\n')
+if prompt=='hang':
+ time.sleep(30)
+if prompt=='fail':
+ print(json.dumps({'type':'error','message':'private raw token'}),flush=True);sys.exit(2)
+if prompt!='missing-thread':print(json.dumps({'type':'thread.started','thread_id':('different-thread' if prompt=='mismatch' else 'fixture-thread')}),flush=True)
+print(json.dumps({'type':'item.completed','item':{'type':'command_execution','aggregated_output':'private tool output'}}),flush=True)
+print(json.dumps({'type':'item.completed','item':{'type':'agent_message','text':('😀'*23000 if prompt=='huge-unicode' else '界'*10000 if prompt=='bounded-unicode' else 'Reply: '+prompt)}},ensure_ascii=False),flush=True)
+print(json.dumps({'type':'turn.completed'}),flush=True)
+'''
+
+class Bridge(unittest.TestCase):
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory(); self.root = Path(self.tmp.name)
+ self.bin = self.root/'bin'; self.bin.mkdir()
+ self.config = self.root/'.config/omarchy/defaults'; self.config.mkdir(parents=True)
+ (self.config/'agent').write_text('codex\n')
+ for name, source in [('codex', FAKE), ('omarchy-agent-account-home', '#!/bin/sh\nexit 0\n')]:
+ f = self.bin/name; f.write_text(source); f.chmod(0o700)
+ self.env = patch.dict(os.environ, {'HOME':str(self.root), 'XDG_STATE_HOME':str(self.root/'state'), 'PATH':str(self.bin), 'CODEX_HOME':str(self.root/'account-one'), 'FIXTURE_LOG':str(self.root/'calls'), 'KEEP_ME':'retained'}, clear=True)
+ self.env.start(); self.output = io.StringIO(); self.server = chat.Server(self.output)
+ def tearDown(self):
+ self.server.close(); self.env.stop(); self.tmp.cleanup()
+ def events(self): return [json.loads(x) for x in self.output.getvalue().splitlines()]
+ def send(self, request, prompt): self.server.handle(dict(op='send',id=request,provider='codex',prompt=prompt))
+ def wait(self):
+ end=time.monotonic()+3
+ while self.server.active and time.monotonic()/dev/null 2>&1; then
+ python3 -B test/agent-chat-ui.py || fail "native agent UI transport"
+ pass "native agent UI: actual Quickshell/Python transport with inert CLI"
+else
+ pass "native agent UI transport # SKIP no quickshell"
+fi
+node test/apps-search-routing.js || fail "native Search Back routing"
+rc=0; out=$(bash test/apps-search 2>&1) || rc=$?
+if [[ $rc == 77 ]]; then
+ pass "native app Search # SKIP no qmltestrunner"
+elif [[ $rc != 0 ]]; then
+ printf '%s\n' "$out" >&2; fail "native app Search"
+else
+ pass "native app Search: app-library filtering, explicit input focus, Back and foreground lifetime"
+fi
rc=0; out=$(bash test/home-gestures 2>&1) || rc=$?
if [[ $rc == 77 ]]; then
pass "the home screen's swipes # SKIP no qmltestrunner"
diff --git a/packages/omamobile-shell/test/apps-search b/packages/omamobile-shell/test/apps-search
new file mode 100755
index 000000000..11b7cbe70
--- /dev/null
+++ b/packages/omamobile-shell/test/apps-search
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+# The actual Search, explicit conversation and input context lifecycle,
+# under Qt Quick Test with inert desktop entries. No shell, OSK, app launch,
+# session bus, user files or compositor is contacted.
+set -euo pipefail
+here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
+runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true)
+[[ -n $runner ]] || { echo "apps-search: no qmltestrunner"; exit 77; }
+work=$(mktemp -d); trap 'rm -rf "$work"' EXIT
+mkdir -p "$work/launcher" "$work/imports/Quickshell/Io"
+# Pure Qt tests never launch a process. Only the transport is inert; all
+# production controller, event, page, field and cancellation logic is real.
+cat > "$work/imports/Quickshell/Io/qmldir" <<'QML'
+module Quickshell.Io
+Process 1.0 Process.qml
+SplitParser 1.0 SplitParser.qml
+QML
+cat > "$work/imports/Quickshell/Io/Process.qml" <<'QML'
+import QtQuick
+QtObject {
+ property var command: []
+ property bool running: false
+ property bool stdinEnabled: false
+ property var stdout: null
+ property var stderr: null
+ signal started()
+ signal exited(int code, int status)
+ function write(text) {}
+}
+QML
+cat > "$work/imports/Quickshell/Io/SplitParser.qml" <<'QML'
+import QtQuick
+QtObject { signal read(string line) }
+QML
+cp "$here/../plugins/omamobile.launcher/AppsSearch.qml" "$here/../plugins/omamobile.launcher/SearchFocus.qml" "$here/../plugins/omamobile.launcher/AgentConversation.qml" "$here/../plugins/omamobile.launcher/AgentChatController.qml" "$work/launcher/"
+cp "$here/apps-search.qml" "$work/tst_apps_search.qml"
+export QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software QML_DISABLE_DISK_CACHE=1
+"$runner" -import "$work/imports" -import "$here/qml-stubs" -input "$work/tst_apps_search.qml"
diff --git a/packages/omamobile-shell/test/apps-search-routing.js b/packages/omamobile-shell/test/apps-search-routing.js
new file mode 100644
index 000000000..6083cc4bf
--- /dev/null
+++ b/packages/omamobile-shell/test/apps-search-routing.js
@@ -0,0 +1,58 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+const fs = require('node:fs');
+const vm = require('node:vm');
+const assert = require('node:assert/strict');
+const path = require('node:path');
+const plugin = path.join(__dirname, '../plugins/omamobile.launcher');
+const link = fs.readFileSync(path.join(plugin, 'AppsSearchLink.js'), 'utf8').replace(/^\.pragma library\s*$/m, '');
+const ctx = vm.createContext({}); vm.runInContext(link, ctx);
+assert.equal(ctx.close(), false);
+let closed = 0;
+const old = {searchOpened: true, closeSearch() { closed++; this.searchOpened = false; }};
+const current = {searchOpened: true, closeSearch() { closed++; this.searchOpened = false; }};
+ctx.publish(old); ctx.publish(current); ctx.clear(old);
+assert.equal(ctx.close(), true); assert.equal(closed, 1); assert.equal(current.searchOpened, false);
+assert.equal(ctx.close(), false);
+ctx.clear(current); assert.equal(ctx.close(), false);
+const back = fs.readFileSync(path.join(plugin, '../omamobile.back/Back.qml'), 'utf8');
+const action = back.match(/function back\(\) \{([\s\S]*?)\n \}/)[1];
+let fallback = 0;
+const receiver = vm.createContext({AppsSearchLink: ctx, Quickshell: {execDetached() { fallback++; }}, BackModel: {ESCAPE_ARGV: ['escape-fixture']}});
+vm.runInContext('function back() {' + action + '}', receiver);
+ctx.publish({searchOpened: true, closeSearch() { this.searchOpened = false; }});
+assert.equal(receiver.back(), 'search'); assert.equal(fallback, 0);
+assert.equal(receiver.back(), 'ok'); assert.equal(fallback, 1);
+let stepped = 0;
+const conversation = {searchOpened: true, backSearch() { stepped++; }, closeSearch() { this.searchOpened = false; }};
+ctx.publish(conversation);
+assert.equal(receiver.back(), 'search'); assert.equal(stepped, 1); assert.equal(conversation.searchOpened, true);
+assert.equal(ctx.close(), true); assert.equal(conversation.searchOpened, false);
+console.log('ok - native Back steps out of chat; Home closes the entire Search; stale registrations stay isolated');
+
+const launcher = fs.readFileSync(path.join(plugin, 'Launcher.qml'), 'utf8');
+function body(name) {
+ const match = launcher.match(new RegExp('function ' + name + '\\([^)]*\\) \\{([\\s\\S]*?)\\n \\}'));
+ assert.ok(match, 'actual ' + name + ' function');
+ return match[1];
+}
+let actions = [];
+const native = vm.createContext({settings: {}, openSearch(text) { actions.push('search:' + text); }, expand() { actions.push('library'); }});
+vm.runInContext('function activateDock() {' + body('activateDock') + '}', native);
+native.activateDock(); assert.deepEqual(actions, ['search:']);
+native.settings.nativeSearch = false; native.activateDock(); assert.deepEqual(actions, ['search:', 'library']);
+native.settings.nativeSearch = true; native.activateDock(); assert.deepEqual(actions, ['search:', 'library', 'search:']);
+actions = [];
+const home = vm.createContext({searchOpened: true, closeSearch() { actions.push('close'); }, Quickshell: {execDetached() { actions.push('home'); }}});
+vm.runInContext('function goHome() {' + body('goHome') + '}', home);
+home.goHome(); assert.equal(actions[0], 'close'); assert.equal(actions.filter(x => x === 'home').length, 2);
+console.log('ok - dock preference retains App Library; Home closes native Search before screen changes');
+
+let summoned = 0;
+const lockOpen = vm.createContext({sessionLocked: true, pluginId: 'fixture', shell: {summon() { summoned++; }}});
+vm.runInContext('function openSearch(text) {' + body('openSearch') + '}', lockOpen);
+lockOpen.openSearch('blocked'); assert.equal(summoned, 0);
+lockOpen.sessionLocked = false; lockOpen.openSearch('fresh'); assert.equal(summoned, 1);
+assert.match(launcher, /sessionLocked: root.sessionLocked/);
+assert.match(body('open'), /if \(sessionLocked\) \{ appsSearch.close\(\); return \}/);
+console.log('ok - known lock blocks launcher requests and is bound into native Search');
diff --git a/packages/omamobile-shell/test/apps-search-visual.py b/packages/omamobile-shell/test/apps-search-visual.py
new file mode 100755
index 000000000..1e9fdb5fe
--- /dev/null
+++ b/packages/omamobile-shell/test/apps-search-visual.py
@@ -0,0 +1,315 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: MIT
+"""Actual Search component, genuine Omarchy UI tokens, neutral offscreen data.
+
+This is a component preview: no native layer-shell/OSK or phone is exercised.
+Frames carry capture timestamps; their rate is not a device performance claim.
+"""
+import argparse
+import json
+import os
+from pathlib import Path
+import re
+import shutil
+import stat
+import subprocess
+import tempfile
+
+HERE = Path(__file__).resolve().parent
+PLUGIN = HERE.parent / 'plugins/omamobile.launcher'
+p = argparse.ArgumentParser(description=__doc__)
+p.add_argument('--theme', choices=('light', 'dark'), required=True)
+p.add_argument('--output', type=Path, required=True)
+p.add_argument('--record', action='store_true')
+p.add_argument('--width', type=int, default=420)
+p.add_argument('--height', type=int, default=900)
+p.add_argument('--omarchy-shell', type=Path, default=Path('/usr/share/omarchy/shell'))
+a = p.parse_args()
+assert 320 <= a.width <= 1440 and 320 <= a.height <= 1440
+out = a.output.resolve()
+out.mkdir(parents=True, exist_ok=False)
+frames = out / 'frames'
+if a.record:
+ frames.mkdir()
+short = Path(tempfile.gettempdir()) / 'omamobile-search-preview'
+short.mkdir(mode=0o700, exist_ok=True)
+s = short.lstat()
+assert stat.S_ISDIR(s.st_mode) and s.st_uid == os.geteuid() and stat.S_IMODE(s.st_mode) == 0o700
+palette = {'dark': {'background': '#14171c', 'foreground': '#e5e9f0', 'accent': '#8ec5ff', 'red': '#ff99a5'},
+ 'light': {'background': '#f7f5ef', 'foreground': '#20252d', 'accent': '#2355a4', 'red': '#9d253a'}}[a.theme]
+with tempfile.TemporaryDirectory(prefix='search-preview-', dir=short) as directory:
+ root = Path(directory)
+ app = root / 'app'
+ app.mkdir()
+ (app / 'launcher').mkdir()
+ shutil.copytree(HERE / 'fixtures/apps-search-icons', app / 'icons')
+ for name in ('AppsSearch.qml', 'SearchFocus.qml', 'AgentConversation.qml', 'AgentChatController.qml'):
+ shutil.copyfile(PLUGIN / name, app / 'launcher' / name)
+ for name in ('Commons', 'Ui'):
+ target = a.omarchy_shell.resolve() / name
+ assert target.is_dir(), f'Genuine Omarchy {name} is required'
+ (app / name).symlink_to(target, target_is_directory=True)
+ home = root / 'home'
+ theme = home / '.local/state/omarchy/current/theme'
+ theme.mkdir(parents=True)
+ (theme / 'colors.toml').write_text(''.join(f'{key} = "{value}"\n' for key, value in palette.items()))
+ (theme / 'shell.toml').write_text('[font]\nbase-size = 12\n')
+ runtime = root / 'run'
+ runtime.mkdir(mode=0o700)
+ bindir = root / 'bin'
+ bindir.mkdir()
+ stub = bindir / 'hyprctl'
+ stub.write_text('#!/usr/bin/python3\nimport sys,json\nvalues={"decoration:rounding":{"int":12},"animations:enabled":{"bool":True},"general:gaps_out":{"custom":"10 10 10 10"}}\nassert sys.argv[-1] in values\nprint(json.dumps(values[sys.argv[-1]]))\n')
+ stub.chmod(0o700)
+ qml = r'''
+import QtQuick
+import QtQuick.Window
+import QtTest
+import Quickshell
+import qs.Commons as Commons
+import "launcher"
+ShellRoot {
+ id: root
+ property bool capturing: false
+ property bool captureBusy: false
+ property int frame: 0
+ property double captureStart: Date.now()
+ property string launched: ""
+ property string fixtureRequest: ""
+ property int fixtureStep: 0
+ QtObject {
+ id: library
+ property var entries: [({id:"example.calendar",name:"Calendar",comment:"Your plans at a glance",icon:"calendar"}),({id:"example.files",name:"Files",comment:"Browse and organise files",icon:"files"}),({id:"example.notes",name:"Notes",comment:"Ideas, lists and reminders",icon:"notes"}),({id:"example.photos",name:"Photos",comment:"Browse your pictures",icon:"photos"}),({id:"example.weather",name:"Weather",comment:"Today and the days ahead",icon:"weather"})]
+ function sortedEntries(query) { return entries.filter(function(entry){return entry.name.toLowerCase().indexOf(query.toLowerCase())>=0}).map(function(entry){return {entry:entry}}) }
+ function entryName(entry) { return entry.name }
+ function iconSource(icon) { return Qt.resolvedUrl("icons/"+icon+".svg") }
+ }
+ FloatingWindow {
+ id: window
+ visible: true
+ implicitWidth: WIDTH
+ implicitHeight: HEIGHT
+ color: Commons.Color.menu.background
+ Item {
+ id: screen
+ anchors.fill: parent
+ // Neutral test scenery under the actual translucent component. This
+ // is not a compositor blur or a capture of a private wallpaper.
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop { position: 0; color: SCENERYTOP }
+ GradientStop { position: 1; color: SCENERYBOTTOM }
+ }
+ Rectangle { x: -parent.width*.3; y: parent.height*.4; width: parent.width*1.8; height: parent.height; rotation: -23; radius: width*.4; color: SCENERYHILL }
+ }
+ SearchFocus { id: prime; opened: search.opened; backingWindowVisible: true; requestGeneration: search.focusGeneration }
+ AppsSearch {
+ id: search
+ anchors.fill: parent
+ anchors.bottomMargin: caption.height
+ appLibrary: library
+ agentId: "codex"
+ agentName: "Codex"
+ chatTransportEnabled: false
+ // Offscreen fixtures cannot grant native layer-shell focus. Observe
+ // component intent only; the phone must qualify that integration.
+ surfaceActive: true
+ inputReady: prime.inputReady
+ onActivated: function(entry) { root.launched=entry.id }
+ }
+ // Neutral protocol fixture: renders actual controller/view behaviour,
+ // never starts a provider process or sends a cloud request.
+ Connections {
+ target: search.chatController
+ function onOutbound(message) {
+ if (message.op === "capabilities") search.chatController.receive({type:"capabilities",provider:"codex",nativeChat:true,installed:true})
+ else if (message.op === "reset") { root.fixtureRequest=""; fixtureReply.stop(); search.chatController.receive({type:"reset"}) }
+ else if (message.op === "cancel") { root.fixtureRequest=""; fixtureReply.stop(); search.chatController.receive({type:"cancelled",id:message.id}) }
+ else if (message.op === "send") {
+ root.fixtureRequest=message.id
+ root.fixtureStep=0
+ search.chatController.receive({type:"started",id:message.id})
+ fixtureReply.restart()
+ }
+ }
+ }
+ Timer {
+ id: fixtureReply
+ interval:180
+ repeat:true
+ onTriggered: {
+ if (!root.fixtureRequest || !search.opened) { stop(); return }
+ root.fixtureStep++
+ if (root.fixtureStep===1) search.chatController.receive({type:"reply",id:root.fixtureRequest,text:"Start with your most important task."})
+ else {
+ search.chatController.receive({type:"reply",id:root.fixtureRequest,text:"Start with your most important task.\n\nLeave time for lunch, a walk and a quieter evening."})
+ search.chatController.receive({type:"done",id:root.fixtureRequest})
+ root.fixtureRequest=""
+ stop()
+ }
+ }
+ }
+ Rectangle {
+ id: caption
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 28
+ color: Commons.Color.menu.background
+ Text {
+ anchors.fill: parent
+ text: "Offscreen component · neutral fixtures"
+ textFormat: Text.PlainText
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: Commons.Color.menu.text
+ font.family: Commons.Style.font.family
+ font.pixelSize: 11
+ }
+ }
+ SignalSpy { id: inputSpy; target: search; signalName: "inputRequested" }
+ TestCase {
+ name: "SearchPreview"
+ when: true
+ property bool captured: false
+ function shot(path) { captured=false;screen.grabToImage(function(image){verify(image.saveToFile(path));captured=true});tryCompare(this,"captured",true,2000) }
+ function initTestCase() {
+ qtest_results.startLogging()
+ tryVerify(function(){return Commons.Color.menu.background.toString()===Quickshell.env("SEARCH_EXPECTED_BG")},3000)
+ tryCompare(Commons.Style,"cornerRadius",12,3000)
+ }
+ function test_flow_and_theme() {
+ root.capturing=Quickshell.env("SEARCH_RECORD")==="1"
+ search.open("")
+ tryCompare(inputSpy,"count",1,3000)
+ tryCompare(prime,"mode","on-demand",1000)
+ compare(search.entries.length,3)
+ wait(220)
+ var header=findChild(search,"searchHeader")
+ verify(header.height <= Commons.Style.space(56))
+ var inputField=findChild(search,"appsSearchInput")
+ verify(inputField.mapToItem(search,0,0).y < Commons.Style.space(80))
+ verify(inputField.height >= 44)
+ verify(findChild(search,"searchResults").height > 100)
+ shot(OPENSHOT)
+ var field=findChild(search,"appsSearchInput")
+ keyClick(Qt.Key_N);wait(170);keyClick(Qt.Key_O);wait(170)
+ compare(search.query,"no")
+ compare(search.entries.length,1)
+ compare(search.entries[0].id,"example.notes")
+ wait(300)
+ shot(FILTERSHOT)
+ keyClick(Qt.Key_A,Qt.ControlModifier);keyClick(Qt.Key_Z);keyClick(Qt.Key_Z)
+ compare(search.entries.length,0)
+ wait(120)
+ shot(EMPTYSHOT)
+ keyClick(Qt.Key_Return);compare(root.launched,"")
+ keyClick(Qt.Key_A,Qt.ControlModifier);keyClick(Qt.Key_N);keyClick(Qt.Key_O)
+ keyClick(Qt.Key_Return)
+ compare(root.launched,"example.notes")
+ verify(!search.opened)
+ wait(220)
+ search.open("")
+ tryCompare(prime,"mode","on-demand",1000)
+ tryVerify(function(){return field.activeFocus},1000)
+ wait(250)
+ var close=findChild(search,"searchClose")
+ mouseClick(close,close.width/2,close.height/2)
+ verify(!search.opened)
+ search.open("")
+ tryCompare(prime,"mode","on-demand",1000)
+ wait(150)
+ compare(field.font.family,Commons.Style.font.family)
+ var inputSurface=findChild(search,"searchInputSurface")
+ compare(inputSurface.radius,Commons.Style.cornerRadius)
+ Commons.Style.applyRoundingJson('{"int":0}');compare(inputSurface.radius,0)
+ Commons.Style.applyRoundingJson('{"int":12}');compare(inputSurface.radius,12)
+ if (typeof Commons.Style.styleAlpha === "function") {
+ var previousStyle=Commons.Style.styleOverrides
+ Commons.Style.styleOverrides={"mobile-search-backdrop-alpha":0.73,"mobile-search-card-alpha":0.81}
+ compare(search.backdropAlpha,0.73)
+ compare(search.cardAlpha,0.81)
+ Commons.Style.styleOverrides=previousStyle
+ }
+ if (typeof Commons.Style.duration === "function") {
+ Commons.Style.reduceMotion=true;compare(search.transitionDuration,0)
+ Commons.Style.reduceMotion=false
+ } else compare(search.transitionDuration,140)
+ wait(160)
+ search.open("Plan tomorrow")
+ tryVerify(function(){return search.opened && search.inputReady},1000)
+ wait(180)
+ shot(ASKSHOT)
+ var card=findChild(search,"askAgentCard")
+ verify(card)
+ mouseClick(card,card.width/2,card.height/2)
+ compare(search.page,"agent")
+ compare(search.chatController.messages.length,0)
+ var composer=findChild(search,"agentDraft")
+ compare(composer.text,"Plan tomorrow")
+ tryVerify(function(){return composer.activeFocus},1000)
+ wait(160)
+ shot(CHATDRAFTSHOT)
+ var send=findChild(search,"agentSend")
+ mouseClick(send,send.width/2,send.height/2)
+ tryVerify(function(){return search.chatController.messages.length===2},1000)
+ tryCompare(search.chatController,"busy",false,2000)
+ compare(composer.text,"")
+ wait(200)
+ shot(CHATREPLYSHOT)
+ var back=findChild(search,"agentBack")
+ mouseClick(back,back.width/2,back.height/2)
+ compare(search.page,"search")
+ verify(search.opened)
+ wait(120)
+ }
+ function cleanupTestCase() {
+ root.capturing=false
+ tryCompare(root,"captureBusy",false,2000)
+ console.log("SEARCH_PREVIEW_RESULT",qtest_results.failCount,qtest_results.passCount)
+ qtest_results.stopLogging()
+ Qt.quit()
+ }
+ }
+ }
+ }
+ Timer {
+ interval:33;repeat:true;running:root.capturing
+ onTriggered: {
+ if(root.captureBusy||root.frame>=300)return
+ root.captureBusy=true
+ var index=root.frame++
+ screen.grabToImage(function(image){image.saveToFile(Quickshell.env("SEARCH_FRAME_DIR")+"/frame"+String(index).padStart(4,"0")+".png");console.log("SEARCH_FRAME",index,Date.now()-root.captureStart);root.captureBusy=false})
+ }
+ }
+ Timer { interval:20000;running:true;onTriggered:Qt.quit() }
+}
+'''
+ qml = qml.replace('WIDTH', str(a.width)).replace('HEIGHT', str(a.height))
+ scenery = ('#283248', '#51415b', '#71647e') if a.theme == 'dark' else ('#d4e0e5', '#c7b8c8', '#afbdcc')
+ for token, color in zip(('SCENERYTOP', 'SCENERYBOTTOM', 'SCENERYHILL'), scenery):
+ qml = qml.replace(token, json.dumps(color))
+ qml = qml.replace('OPENSHOT', json.dumps(str(out / 'search-open.png'))).replace('FILTERSHOT', json.dumps(str(out / 'search-filtered.png'))).replace('EMPTYSHOT', json.dumps(str(out / 'search-empty.png')))
+ qml=qml.replace('ASKSHOT',json.dumps(str(out/'search-ask.png'))).replace('CHATDRAFTSHOT',json.dumps(str(out/'chat-draft.png'))).replace('CHATREPLYSHOT',json.dumps(str(out/'chat-reply.png')))
+ (app / 'shell.qml').write_text(qml)
+ env = os.environ | {'HOME': str(home), 'XDG_CONFIG_HOME': str(home / '.config'), 'XDG_DATA_HOME': str(root / 'data'),
+ 'XDG_CACHE_HOME': str(root / 'cache'), 'XDG_RUNTIME_DIR': str(runtime), 'QT_QPA_PLATFORM': 'offscreen',
+ 'QT_QPA_PLATFORMTHEME': '', 'QT_QUICK_CONTROLS_STYLE': 'Basic', 'QT_QUICK_BACKEND': 'software',
+ 'QML_DISABLE_DISK_CACHE': '1', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/nonexistent',
+ 'DBUS_SYSTEM_BUS_ADDRESS': 'unix:path=/nonexistent', 'PATH': str(bindir) + ':/usr/bin:/bin',
+ 'SEARCH_RECORD': '1' if a.record else '0', 'SEARCH_EXPECTED_BG': palette['background'], 'SEARCH_FRAME_DIR': str(frames)}
+ for name in ('WAYLAND_DISPLAY', 'DISPLAY', 'HYPRLAND_INSTANCE_SIGNATURE'):
+ env.pop(name, None)
+ result = subprocess.run(['/usr/bin/quickshell', '--path', str(app / 'shell.qml'), '--no-color'], env=env, capture_output=True, text=True, timeout=25)
+ log = result.stdout + result.stderr
+ (out / 'qml-ui.log').write_text(log)
+ print(log[-10000:])
+ assert result.returncode == 0 and 'SEARCH_PREVIEW_RESULT 0 2' in log
+ assert not any(word in log for word in ('ReferenceError:', 'TypeError:', 'Failed to load configuration'))
+ captured = [(int(i), int(t)) for i, t in re.findall(r'SEARCH_FRAME (\d+) (\d+)', log)]
+ if a.record:
+ assert len(captured) > 15 and len(list(frames.glob('frame*.png'))) == len(captured)
+ assert all(b[1] > a[1] for a, b in zip(captured, captured[1:]))
+ (out / 'frames.json').write_text(json.dumps(captured) + '\n')
+ (out / 'RESULT.json').write_text(json.dumps({'result': 'PASS', 'theme': a.theme, 'palette': palette, 'viewport': [a.width, a.height],
+ 'frames': len(captured), 'offscreen': True, 'phoneCapture': False, 'nativeLayerFocusQualified': False}, indent=2) + '\n')
diff --git a/packages/omamobile-shell/test/apps-search.qml b/packages/omamobile-shell/test/apps-search.qml
new file mode 100644
index 000000000..e6006fc9d
--- /dev/null
+++ b/packages/omamobile-shell/test/apps-search.qml
@@ -0,0 +1,469 @@
+// SPDX-License-Identifier: MIT
+import QtQuick
+import QtTest
+import "launcher"
+
+Item {
+ id: view
+ width: 420
+ height: 900
+ QtObject {
+ id: library
+ property var all: [({ id: "example.calendar", name: "Calendar", icon: "" }),
+ ({ id: "example.notes", name: "Notes", icon: "" }),
+ ({ id: "example.files", name: "Files", icon: "" })]
+ property string lastQuery: ""
+ function sortedEntries(query) {
+ lastQuery = query
+ return all.filter(function(entry) { return entry.name.toLowerCase().indexOf(query.toLowerCase()) >= 0 })
+ .map(function(entry) { return {entry: entry} })
+ }
+ function entryName(entry) { return entry.name }
+ function iconSource(icon) { return "" }
+ }
+ SearchFocus { id: focus; opened: search.opened; requestGeneration: search.focusGeneration; backingWindowVisible: true }
+ AppsSearch { chatTransportEnabled: false; inputReady: focus.inputReady; id: search; anchors.fill: parent; appLibrary: library; surfaceActive: true; transitionDuration: 0 }
+ SignalSpy { id: inputSpy; target: search; signalName: "inputRequested" }
+ SignalSpy { id: closeSpy; target: search; signalName: "dismissed" }
+ SignalSpy { id: appSpy; target: search; signalName: "activated" }
+ SignalSpy { id: handoffSpy; target: search; signalName: "handoffAgent" }
+ SignalSpy { id: chooseSpy; target: search; signalName: "chooseAgent" }
+ Component { id: largeMetricConversation; AgentConversation { controller: search.chatController; foreground: search.foreground; muted: search.muted; cardColor: search.cardColor } }
+ TestCase {
+ name: "AppsSearch"
+ when: windowShown
+ property Item field: null
+ function initTestCase() { field = findChild(search, "appsSearchInput"); verify(field) }
+ function init() {
+ search.close()
+ search.sessionLocked = false
+ search.page = "search"
+ search.agentId = ""
+ search.chatController.reset()
+ search.chatController.receive({type:"reset"})
+ findChild(search,"agentDraft").text = ""
+ search.surfaceActive = true
+ focus.backingWindowVisible = true
+ view.width = 420; view.height = 900
+ inputSpy.clear(); closeSpy.clear(); appSpy.clear(); handoffSpy.clear(); chooseSpy.clear()
+ }
+ function test_known_lock_cancels_initial_prime_and_requires_new_tap() {
+ search.surfaceActive = false
+ search.open("")
+ var generation = search.focusGeneration
+ compare(focus.mode, "exclusive")
+ search.sessionLocked = true
+ verify(!search.opened)
+ verify(search.focusGeneration > generation)
+ compare(focus.mode, "none")
+ verify(!search.focusPending)
+ search.open("ignored")
+ verify(!search.opened)
+ search.sessionLocked = false
+ search.surfaceActive = true
+ wait(110)
+ compare(inputSpy.count, 0)
+ verify(!search.opened)
+ search.open("fresh")
+ tryCompare(inputSpy, "count", 1)
+ }
+ function test_known_lock_cancels_actual_queued_input_callback() {
+ search.surfaceActive = false
+ search.open("")
+ tryCompare(focus, "mode", "on-demand")
+ search.surfaceActive = true // actual callback queued, not yet delivered
+ search.sessionLocked = true
+ search.sessionLocked = false
+ wait(100)
+ compare(inputSpy.count, 0)
+ verify(!search.opened)
+ verify(!field.activeFocus)
+ compare(focus.mode, "none")
+ }
+ function test_known_lock_closes_after_input_focus() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ search.sessionLocked = true
+ verify(!search.opened)
+ compare(focus.mode, "none")
+ verify(!field.activeFocus)
+ search.sessionLocked = false
+ wait(100)
+ verify(!search.opened)
+ compare(inputSpy.count, 2) // one show, one release; no unlock show
+ }
+ function test_ask_card_opens_editable_draft_without_submission() {
+ search.agentId = "fixture"
+ search.agentName = "Fixture Agent"
+ search.open("Plan tomorrow")
+ search.openAgent()
+ compare(search.page, "agent")
+ var draft = findChild(search, "agentDraft")
+ compare(draft.text, "Plan tomorrow")
+ compare(search.chatController.busy, false)
+ compare(search.chatController.messages.length, 0)
+ tryVerify(function() { return draft.activeFocus })
+ search.back()
+ compare(search.page, "search")
+ verify(search.opened)
+ search.openAgent()
+ compare(draft.text, "Plan tomorrow")
+ }
+ function test_native_chat_requires_explicit_send_and_discards_late_cancelled_events() {
+ search.agentId = "fixture"
+ search.open("Draft")
+ search.openAgent()
+ var chat = search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ verify(!chat.busy)
+ search.sendAgent("Explicit request")
+ verify(chat.busy)
+ var id = chat.activeId
+ chat.receive({type:"started",id:id})
+ chat.receive({type:"delta",id:id,text:"Part"})
+ chat.receive({type:"reply",id:id,text:"Part complete"})
+ compare(chat.messages[1].text,"Part complete")
+ search.back()
+ verify(chat.busy)
+ verify(!chat.send("blocked while stopping"))
+ chat.receive({type:"delta",id:id,text:" stale"})
+ compare(chat.messages[1].text,"Part complete")
+ chat.receive({type:"cancelled",id:id})
+ verify(!chat.busy)
+ verify(search.opened)
+ search.openAgent()
+ compare(chat.messages.length,2)
+ }
+ function test_lock_cancels_chat_work_and_never_refocuses_composer_on_unlock() {
+ search.agentId = "fixture"
+ search.open("Draft")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ search.sendAgent("Explicit request")
+ var id=chat.activeId
+ chat.receive({type:"started",id:id})
+ search.sessionLocked=true
+ verify(!search.opened)
+ verify(chat.busy)
+ chat.receive({type:"cancelled",id:id})
+ verify(!chat.busy)
+ chat.receive({type:"delta",id:id,text:"stale"})
+ compare(chat.messages[1].text,"")
+ search.sessionLocked=false
+ wait(100)
+ verify(!search.opened)
+ verify(!findChild(search,"agentDraft").activeFocus)
+ }
+ function test_unsupported_agent_never_starts_native_work() {
+ search.agentId="terminal-fixture"
+ search.open("Draft")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"terminal-fixture",nativeChat:false,installed:true,reason:"Use terminal"})
+ search.sendAgent("Not submitted")
+ verify(!chat.busy)
+ compare(chat.messages.length,0)
+ }
+ function test_reset_requires_ack_before_matching_capabilities_can_enable_send() {
+ search.agentId="fixture"
+ search.open("Draft")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ chat.reset()
+ verify(chat.resetPending)
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ verify(!chat.send("blocked until acknowledgement"))
+ chat.receive({type:"reset"})
+ verify(!chat.resetPending)
+ verify(!chat.send("blocked until fresh capabilities"))
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ verify(chat.send("accepted after reset"))
+ verify(/^[A-Za-z0-9_-]{1,80}$/.test(chat.activeId))
+ }
+ function test_unaccepted_or_oversize_request_keeps_editable_draft_and_hides_raw_error() {
+ search.agentId="fixture"
+ search.open("")
+ search.openAgent()
+ var chat=search.chatController,draft=findChild(search,"agentDraft")
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ draft.text="Keep this editable"
+ search.sendAgent(draft.text)
+ compare(draft.text,"Keep this editable")
+ var id=chat.activeId
+ chat.receive({type:"error",id:id,code:"busy",text:"PRIVATE_DIAGNOSTIC_MUST_NOT_RENDER"})
+ compare(draft.text,"Keep this editable")
+ compare(chat.messages.length,0)
+ verify(chat.error.indexOf("PRIVATE_DIAGNOSTIC")<0)
+ draft.text=new Array(8194).join("x")
+ search.sendAgent(draft.text)
+ verify(!chat.busy)
+ compare(draft.text.length,8193)
+ verify(chat.error.indexOf("too long")>=0)
+ }
+ function test_account_reset_before_started_does_not_drop_explicit_request() {
+ search.agentId="fixture"
+ search.open("Draft")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ search.sendAgent("Explicit request")
+ var id=chat.activeId
+ chat.receive({type:"reset"}) // backend account-home transition, not our reset
+ compare(chat.activeId,id)
+ chat.receive({type:"started",id:id})
+ compare(chat.messages[0].text,"Explicit request")
+ chat.receive({type:"reply",id:id,text:"Answer"})
+ chat.receive({type:"done",id:id})
+ verify(!chat.busy)
+ compare(chat.messages[1].text,"Answer")
+ }
+ function test_conversation_contains_large_platform_control_width() {
+ var panel = createTemporaryObject(largeMetricConversation, view, {width:320, height:240})
+ verify(panel !== null)
+ var draft = findChild(panel, "agentDraft")
+ var action = findChild(panel, "agentSend")
+ action.implicitWidth = 400
+ panel.draft = "A draft with a platform-preferred width larger than the viewport"
+ waitForPolish(panel)
+ wait(50)
+ var pos = draft.mapToItem(panel, 0, 0)
+ verify(pos.x >= 0 && pos.x + draft.width <= panel.width,
+ "Platform button metrics must not push the composer outside the conversation")
+ var actionPos = action.mapToItem(panel, 0, 0)
+ verify(actionPos.x >= 0 && actionPos.x + action.width <= panel.width,
+ "Long platform button labels stay inside their row")
+ }
+ function test_conversation_compact_viewports_keep_editable_draft_and_terminal_action_inside() {
+ search.agentId="terminal-fixture"
+ search.open("")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"terminal-fixture",nativeChat:false,installed:true})
+ var draft=findChild(search,"agentDraft")
+ draft.text=new Array(301).join("A long editable draft ")
+ var sizes=[[320,240],[740,320]]
+ for(var i=0;i=0&&pos.y>=0&&pos.x+item.width<=search.width+1&&pos.y+item.height<=search.height+1,names[j]+" stays inside "+sizes[i]+" at "+pos.x+","+pos.y+" "+item.width+"x"+item.height)
+ }
+ }
+ }
+ function test_actual_send_button_waits_for_acceptance_before_clearing_draft() {
+ search.agentId="fixture"
+ search.open("")
+ search.openAgent()
+ var chat=search.chatController,draft=findChild(search,"agentDraft")
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ draft.text="An explicit button request"
+ var send=findChild(search,"agentSend")
+ wait(50);mouseClick(send,send.width/2,send.height/2)
+ verify(chat.busy);compare(draft.text,"An explicit button request");compare(chat.messages.length,0)
+ chat.receive({type:"started",id:chat.activeId})
+ compare(draft.text,"");compare(chat.messages[0].text,"An explicit button request")
+ }
+ function test_terminal_handoff_click_is_explicit_and_closes_own_input() {
+ search.agentId="terminal-fixture"
+ search.open("Editable terminal draft")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"terminal-fixture",nativeChat:false,installed:true})
+ var send=findChild(search,"agentSend")
+ wait(50);mouseClick(send,send.width/2,send.height/2)
+ compare(handoffSpy.count,1)
+ compare(handoffSpy.signalArguments[0][0],"Editable terminal draft")
+ verify(!search.opened);verify(!chat.busy)
+ }
+ function test_without_configured_agent_card_requests_choice_without_submission() {
+ search.open("Draft")
+ search.openAgent()
+ compare(chooseSpy.count,1)
+ compare(search.page,"search")
+ compare(search.chatController.messages.length,0)
+ verify(!search.chatController.busy)
+ }
+ function test_transport_exit_releases_stop_wait_and_keeps_draft_for_terminal() {
+ search.agentId="fixture"
+ search.open("Retained draft")
+ search.openAgent()
+ var chat=search.chatController
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ search.sendAgent("Retained draft")
+ var id=chat.activeId
+ chat.transportEnded() // actual onExited handler, with inert transport
+ verify(!chat.busy);compare(chat.stoppingId,"");verify(!chat.available)
+ compare(findChild(search,"agentDraft").text,"Retained draft")
+ chat.receive({type:"reply",id:id,text:"stale"});compare(chat.messages.length,0)
+ chat.reset() // explicit New chat may restart only the local serve process
+ verify(chat.processWanted);verify(chat.resetPending);verify(!chat.send("not before restart ACK"))
+ chat.receive({type:"reset"})
+ chat.receive({type:"capabilities",provider:"fixture",nativeChat:true,installed:true})
+ verify(chat.send("fresh explicit request"))
+ }
+ function test_mapped_surface_is_primed_on_each_open_and_releases_on_close() {
+ search.open("")
+ compare(focus.mode, "exclusive")
+ tryCompare(focus, "mode", "on-demand")
+ tryCompare(inputSpy, "count", 1)
+ search.close()
+ compare(focus.mode, "none")
+ search.open("")
+ compare(focus.mode, "exclusive")
+ tryCompare(focus, "mode", "on-demand")
+ tryVerify(function() { return inputSpy.count >= 3 })
+ }
+ function test_prime_waits_for_the_actual_backing_window() {
+ focus.backingWindowVisible = false
+ search.open("")
+ wait(100)
+ compare(focus.mode, "exclusive")
+ verify(!focus.inputReady)
+ compare(inputSpy.count, 0)
+ focus.backingWindowVisible = true
+ tryCompare(focus, "mode", "on-demand")
+ tryCompare(inputSpy, "count", 1)
+ }
+ function test_explicit_open_waits_for_its_surface_focus() {
+ search.surfaceActive = false
+ search.open("")
+ wait(30)
+ compare(inputSpy.count, 0)
+ verify(search.focusPending)
+ search.surfaceActive = true
+ tryCompare(inputSpy, "count", 1)
+ verify(field.activeFocus)
+ compare(inputSpy.signalArguments[0][0], true)
+ }
+ function test_close_cancels_deferred_focus() {
+ search.surfaceActive = false
+ search.open("")
+ tryCompare(focus, "mode", "on-demand")
+ search.surfaceActive = true // queues the real deferred focus callback
+ search.close() // closes before that callback can execute
+ wait(30)
+ compare(inputSpy.count, 0)
+ verify(!search.opened)
+ verify(!field.activeFocus)
+ }
+ function test_manual_hide_is_not_reopened_by_a_late_focus_callback() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ // The user can hide the OSK while the text field retains focus.
+ // Further queued callbacks must not issue another show request.
+ Qt.inputMethod.hide()
+ search.queueFocus(); search.queueFocus()
+ wait(30)
+ compare(inputSpy.count, 1)
+ verify(!search.focusPending)
+ }
+ function test_close_reopen_does_not_adopt_the_previous_focus_request() {
+ search.open("Notes"); search.close(); search.open("Files")
+ tryCompare(inputSpy, "count", 1)
+ compare(search.query, "Files")
+ compare(library.lastQuery, "Files")
+ compare(search.entries.length, 1)
+ }
+ function test_keyboard_query_uses_the_shared_app_library() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ keyClick(Qt.Key_N)
+ keyClick(Qt.Key_O); keyClick(Qt.Key_T); keyClick(Qt.Key_E); keyClick(Qt.Key_S)
+ tryCompare(search, "query", "notes")
+ compare(library.lastQuery, "notes")
+ compare(search.entries[0].id, "example.notes")
+ }
+ function test_clear_returns_to_suggestions_without_a_new_focus_request() {
+ search.open("Notes")
+ tryCompare(inputSpy, "count", 1)
+ var clear = findChild(search, "searchClear")
+ verify(clear.visible)
+ mouseClick(clear, clear.width / 2, clear.height / 2)
+ compare(search.query, "")
+ compare(search.entries.length, 3)
+ verify(field.activeFocus)
+ wait(100)
+ compare(inputSpy.count, 1)
+ verify(!clear.visible)
+ }
+ function test_no_match_stays_in_search_without_an_agent_action() {
+ search.open("No matching application")
+ tryCompare(inputSpy, "count", 1)
+ compare(search.entries.length, 0)
+ var empty = findChild(search, "searchEmpty")
+ verify(empty.visible)
+ compare(empty.text, "No apps found")
+ keyClick(Qt.Key_Return)
+ compare(appSpy.count, 0)
+ verify(search.opened)
+ }
+ function test_enter_releases_input_before_the_launch_signal() {
+ search.open("Notes")
+ tryCompare(inputSpy, "count", 1)
+ keyClick(Qt.Key_Return)
+ compare(appSpy.count, 1)
+ compare(appSpy.signalArguments[0][0].id, "example.notes")
+ verify(!search.opened)
+ verify(!field.activeFocus)
+ compare(inputSpy.signalArguments[inputSpy.count - 1][0], false)
+ }
+ function test_escape_closes_the_native_panel() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ keyClick(Qt.Key_Escape)
+ compare(closeSpy.count, 1)
+ verify(!search.opened)
+ }
+ function test_foreground_change_releases_without_hiding_foreign_input() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ search.surfaceActive = false
+ compare(closeSpy.count, 1)
+ compare(inputSpy.count, 1, "no hide request after another window took focus")
+ verify(!search.opened)
+ verify(!field.activeFocus)
+ }
+ function test_short_keyboard_viewport_keeps_the_input_in_bounds() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ view.width = 740; view.height = 88
+ waitForPolish(search)
+ tryVerify(function() {
+ var at = field.mapToItem(search, 0, 0)
+ return field.height >= 44 && at.y >= 0 && at.y + field.height <= search.height
+ }, 1000)
+ verify(!findChild(search, "searchResults").visible)
+ }
+ function test_layout_tracks_the_actual_available_viewport() {
+ search.open("")
+ tryCompare(inputSpy, "count", 1)
+ view.width = 740; view.height = 320
+ waitForPolish(search)
+ verify(field.height >= 44)
+ verify(field.y + field.height <= search.height)
+ var list = findChild(search, "searchResults")
+ verify(list.height > 0)
+ var inputAt = field.mapToItem(search, 0, 0)
+ var listAt = list.mapToItem(search, 0, 0)
+ verify(listAt.y >= inputAt.y + field.height)
+ verify(listAt.y + list.height <= search.height)
+ var close = findChild(search, "searchClose")
+ verify(close.width >= 44 && close.height >= 44)
+ }
+ }
+}
diff --git a/packages/omamobile-shell/test/drawer-touch b/packages/omamobile-shell/test/drawer-touch
index a763b6b42..1a385896c 100755
--- a/packages/omamobile-shell/test/drawer-touch
+++ b/packages/omamobile-shell/test/drawer-touch
@@ -68,6 +68,9 @@ Item {
hide: function(id) { root.calls = root.calls.concat(["hide"]); root.close(); return true }
})
readonly property string pluginId: "omamobile.launcher"
+ // Search is tested separately; these are the drawer's lifecycle calls.
+ property QtObject appsSearch: QtObject { function close() {} }
+ property bool searchOpened: false
property bool opened: false
property string query: ""
property var apps: []
diff --git a/packages/omamobile-shell/test/drawer-touch.qml b/packages/omamobile-shell/test/drawer-touch.qml
index 95b40b69b..a4f9c65ed 100644
--- a/packages/omamobile-shell/test/drawer-touch.qml
+++ b/packages/omamobile-shell/test/drawer-touch.qml
@@ -38,6 +38,7 @@ Item {
}
function init() {
+ harness.searchOpened = false
harness.close()
tryCompare(harness, "progress", 0, 3000)
harness.calls = []
@@ -265,6 +266,13 @@ Item {
compare(layoutOf(), closed, "closed again")
}
+ function test_no_home_swipe_while_native_search_is_open() {
+ harness.searchOpened = true
+ verify(!harness.gestureBegin())
+ compare(harness.progress, 0)
+ harness.searchOpened = false
+ }
+
function test_no_home_swipe_while_open() {
openSettled()
verify(!harness.gestureBegin(), "an open drawer ignores the home screen's swipe")
diff --git a/packages/omamobile-shell/test/fixtures/apps-search-icons/calendar.svg b/packages/omamobile-shell/test/fixtures/apps-search-icons/calendar.svg
new file mode 100644
index 000000000..63f458ea9
--- /dev/null
+++ b/packages/omamobile-shell/test/fixtures/apps-search-icons/calendar.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/packages/omamobile-shell/test/fixtures/apps-search-icons/files.svg b/packages/omamobile-shell/test/fixtures/apps-search-icons/files.svg
new file mode 100644
index 000000000..f890fbd6d
--- /dev/null
+++ b/packages/omamobile-shell/test/fixtures/apps-search-icons/files.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/packages/omamobile-shell/test/fixtures/apps-search-icons/notes.svg b/packages/omamobile-shell/test/fixtures/apps-search-icons/notes.svg
new file mode 100644
index 000000000..f51547e3b
--- /dev/null
+++ b/packages/omamobile-shell/test/fixtures/apps-search-icons/notes.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/packages/omamobile-shell/test/fixtures/apps-search-icons/photos.svg b/packages/omamobile-shell/test/fixtures/apps-search-icons/photos.svg
new file mode 100644
index 000000000..b6e82d0d1
--- /dev/null
+++ b/packages/omamobile-shell/test/fixtures/apps-search-icons/photos.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/packages/omamobile-shell/test/fixtures/apps-search-icons/weather.svg b/packages/omamobile-shell/test/fixtures/apps-search-icons/weather.svg
new file mode 100644
index 000000000..e5e967e2b
--- /dev/null
+++ b/packages/omamobile-shell/test/fixtures/apps-search-icons/weather.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/packages/omamobile-shell/test/pill-touch b/packages/omamobile-shell/test/pill-touch
index 494d2d6cc..cd3299b8c 100755
--- a/packages/omamobile-shell/test/pill-touch
+++ b/packages/omamobile-shell/test/pill-touch
@@ -95,6 +95,9 @@ Item {
readonly property int dockHeight: 96
property bool appOnScreen: false
property bool opened: false
+ property bool searchOpened: false
+ property var settings: ({nativeSearch:false})
+ function closeSearch() { root.searchOpened = false }
property bool oskOpen: false
property bool fullscreenOnScreen: false
property bool sessionLocked: false
@@ -115,6 +118,7 @@ Item {
readonly property string agentName: ""
readonly property color foreground: "#c0caf5"
function expand() { Quickshell.execDetached(["expand"]) }
+ function openSearch(text) { root.searchOpened=true; Quickshell.execDetached(["native-search",text]) }
function dismiss(speed) { Quickshell.execDetached(["dismiss"]) }
%s
@@ -169,7 +173,7 @@ Item {
""" % ("root." + strip_height if not strip_height.isdigit() else strip_height,
definition("stripShown"), definition("keyboardStripShown"), definition("dockShown"),
zone("omamobile-dock"), zone("omamobile-home-strip"),
- function("goHome"), function("showRecents"), function("keyboardCall"), function("voiceHold") + "\n\n" + function("voiceCall"),
+ function("activateDock") + "\n\n" + function("goHome"), function("showRecents"), function("keyboardCall"), function("voiceHold") + "\n\n" + function("voiceCall"),
content.replace("root.oskOpen", "false"), window_content("omamobile-dock"), content.replace("root.oskOpen", "true"),
component("SearchPill"), component("HomePill"), component("HomeSwipe"))
open(sys.argv[2], "w").write(out)
diff --git a/packages/omamobile-shell/test/pill-touch.qml b/packages/omamobile-shell/test/pill-touch.qml
index 6c34f5422..b90a0dee0 100644
--- a/packages/omamobile-shell/test/pill-touch.qml
+++ b/packages/omamobile-shell/test/pill-touch.qml
@@ -34,6 +34,8 @@ Item {
// towards the next one's.
wait(600)
Quickshell.executed = []
+ harness.searchOpened = false
+ harness.settings = ({nativeSearch:false})
}
function calls(fragment) {
@@ -99,6 +101,19 @@ Item {
return Quickshell.executed.filter(function(argv) { return argv.join(" ").indexOf("fbcli -E button-pressed") >= 0 }).length
}
+ function test_native_search_keeps_home_reachable_after_manual_keyboard_hide() {
+ harness.appOnScreen = false
+ harness.opened = false
+ harness.fullscreenOnScreen = false
+ harness.sessionLocked = false
+ harness.searchOpened = true
+ harness.oskOpen = false
+ compare(harness.stripZone, harness.stripHeight)
+ compare(harness.dockZone, 0)
+ harness.goHome()
+ verify(!harness.searchOpened)
+ }
+
function test_holding_the_pill_opens_the_voice_bar_with_a_tick() {
var strips = ["pillStrip", "keyboardStrip"]
for (var i = 0; i < strips.length; i++) {
@@ -178,6 +193,17 @@ Item {
// The dock's search pill on the home screen: a tap opens the drawer
// (with the keyboard), a hold opens the voice bar, a swipe recent apps.
+ function test_a_tap_on_the_search_pill_selects_native_search_when_enabled() {
+ harness.settings = ({nativeSearch:true})
+ var dock = find(harness, "dock")
+ tap(dock, dock.width / 2, dock.height / 2)
+ wait(600)
+ compare(calls("native-search"), 1)
+ compare(calls("expand"), 0)
+ verify(harness.searchOpened)
+ compare(voiceCalls("start"), 0)
+ }
+
function test_a_tap_on_the_search_pill_opens_the_drawer() {
var dock = find(harness, "dock")
tap(dock, dock.width / 2, dock.height / 2)
diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version
index b53b42f2a..24b086d02 100644
--- a/packages/omamobile-shell/version
+++ b/packages/omamobile-shell/version
@@ -1 +1 @@
-0.2.114
+0.2.115