Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/TOUCH-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,72 @@ Priorities: **P1** broken, unsafe, or a dead end on a phone; **P2** noticeably a
- **3.6 Haptics (P3):** none in the shell. A small helper for long-press, the switcher hold and the answer threshold (cs40l26 exists). It buzzes: announce before testing.
- **3.7 Polish (P3):** QS edit mode's "−" badges and Reset confirm; Wi-Fi/Bluetooth Forget confirm or undo; "Added to home" feedback after a drawer long-press; the missing-app tile says "Not installed" instead of its raw id; switcher cards show the app's name, not its id (0.2.43: the desktop entry's name, web apps included, centred over a card that snaps to the centre); OWL slider drags only on their own axis; a fade on the drawer's clipped last row; a safe-area token for the rounded corners; a pull-down strip over fullscreen apps; a Gestures table in the shell README.

## Shared Chromium and Grok Bot fitting revision, 2026-11-10 (3.1)

The combined package passed the Pixel 6a checks recorded below. Both apps
share the established
578 px layout target and internal geometry detection, including simpledrm.
The 7 Pro's 480 logical px retains 0.83, the 9a's 405 gets 0.70, and the
6a's 360 gets 0.62 for a fresh default. The owner's custom 0.70 and site
zoom stay unchanged. Historical setup markers preserve deleted flags;
defaults and the exact generated-scale migration run once. Chrome is deferred
until the launcher prerequisite is released. The maintainer assigns the
package version at merge.

Geometry-free Chromium defaults run even before panel geometry is available;
only the scale waits. A separate defaults marker preserves removals before
the phone bar retries the helper at shell start with live monitor geometry,
including computed/auto Lua scales. A failed helper never aborts user setup. Fresh defaults deliberately use a generic Android mobile user agent without a device model; existing user-agent choices are preserved.

November 14 parser follow-up: an unquoted app URL fragment must not hide
later custom scale or user-agent flags. Comment recognition now follows
unquoted token boundaries; the new preservation regression fails with the
previous parser and passes with the correction. This edge-case correction
has offline test evidence only and was not in the historical package below.

Runbook (low risk, userspace only):

1. Run the shell package suite and policy gate. Expect no failures; stop on
any new failure. Save the installed package, both apps' flags, all
`omamobile-chromium-*`, `omamobile-grok-bot-fit` and
`omamobile-browser-fit-*` and `omamobile-browser-defaults-*` markers, and the
user's shell profile/plugins.
2. Announce the package installation and browser restart. Install the full
candidate package. Run user setup and inspect flags: custom 0.70 and UA/IME
removals must survive; fresh scratch defaults at 360 px must be 0.62 for
both apps. Stop and restore if a user override changes.
3. Reopen through normal desktop/browser and web-app entry points. Expect a
complete UA as one argument, working keyboard input, and equal viewport,
client and scroll widths on the diagnostic page. Check Gmail's saved zoom
and the personal transparent clock. Stop on overflow or lost settings.
4. Rollback: restore the prior package, flags, done markers and shell profile
and plugins, restart the shell if needed and reopen the apps normally.

### Pixel 6a verification, 2026-11-11

The exact tested combined package is `omamobile-shell 0.2.119-1`, integration
[`83326ed6d09684ae80f38c9360e8c4e864d32614`](https://github.com/latentoperator/omarchy-mobile/commit/83326ed6d09684ae80f38c9360e8c4e864d32614) on the fork's `bringup/bluejay-userspace-tested-20261111` branch, SHA-256
`02e0acadd2568bf167946a87c740626fffb59068918271bdb2026fac799e0270`, on
`7.3.0-rc6-omamobile-bluejay-input-gated0`. Installation and cold shell restart
were performed while unlocked. All six required phone-smoke checks passed;
package verification found 370 files and none altered.

The installed helper wrote UA/IME/first-run defaults in an isolated home
without geometry, then obtained actual live monitor geometry for a computed
Lua scale and fitted both apps to 0.62. Removing UA/IME flags before that retry
left them removed. Normal Chromium launch with an isolated profile and the
owner's existing 0.70 gave equal viewport/client/scroll widths of 515 and a
complete mobile UA. Personal browser flags, saved Chrome zoom and the clock
were preserved. Only main's expected remote-session disable was added to the
shell profile. Temporary fixtures were removed and the phone returned home.

Policy, the complete combined shell suite and independent review passed;
both published UX heads passed repository and every-package CI. These runtime
results qualify the exact combined package above, not a later kernel or an
unrelated subsequently merged shell change. The maintainer's existing/fresh-user 7 Pro checks passed on November 12; the 9a owner's one-time migration check remains before merge.
No kernel or boot image was changed for this userspace verification.


## Omarchy patches this needs (upstreamable)

1. Notifications: swipe to dismiss and a touch close button (1.1). Patch 0017, omamobile-omarchy 0.1.10 (built and tested offline, not yet checked on the phone). The shade under quick settings lists the toasts and history, and a sideways swipe on a row forgets that one notification through the service (patch 0019, omamobile-omarchy 0.1.11, omamobile-shell 0.2.28; offline as above).
Expand Down
25 changes: 25 additions & 0 deletions packages/omamobile-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@ The package contract follows omarchy-mac's: `./install DESTDIR` stages files and

Develop on a desktop with `phone/dev/run-desktop` from the repo root.

### Chromium and Grok Bot sizing

`omamobile-browser-setup`, called by user setup and again by the phone bar at
shell start, fits both apps to the same
578 px layout from the internal output's short logical side. It keeps the
reference phone's 0.83 cap: 480 px gives 0.83, 405 px gives 0.70 and 360 px
gives 0.62. Geometry comes from Hyprland when available, or an internal DRM
mode plus the numeric scale in `hypr/monitors.lua` before the compositor runs.
DSI, eDP and simpledrm's Unknown outputs are supported; external outputs are
ignored. Missing geometry defers only the scale factor. Chromium's user agent,
input-method and no-first-run defaults are written independently. The shell
retry obtains live geometry for an auto or computed Lua scale; helper failure
does not stop the remaining user setup.

Defaults run once, tracked by `omamobile-browser-fit-chromium` and
`omamobile-browser-fit-grok-bot` in Omarchy's done directory, with
`omamobile-browser-defaults-chromium` preserving removals while scale is
deferred. Old Chromium
per-feature markers also count: deleting a mobile UA, input-method flag or
scale after its original setup remains a user choice. Only the exact generated,
unquoted 0.83 scale line migrates once; custom values and quoted overrides
stay. Chromium's version is read only immediately before writing a missing UA.
No browser profile or site zoom changes. Chrome defaults are deferred until
its quote-aware launcher is released separately in omarchy-pkgs.

## Device settings

After the shared rules, `hypr/phone.lua` loads `/usr/share/omamobile/hypr/device.lua` if a device package installs one, for settings only that phone needs (an inner and an outer panel, its own input devices). Every session that loads `phone.lua` (setup-user adds it to `looknfeel.lua`) gets it, new and existing users alike. It runs under `pcall`: a syntax or runtime error in the device file is logged and the shared rules stay in force. With no device file nothing changes, so every phone today is unaffected.
182 changes: 182 additions & 0 deletions packages/omamobile-shell/bin/omamobile-browser-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Seed mobile browser flags from the phone's geometry, preserving user choices."""
import json
import math
import os
from pathlib import Path
import re
import shlex
import subprocess


def monitor_scale(text):
match = re.search(r"^local omarchy_monitor_scale = ([0-9.]+)(?:\s*/\s*([0-9.]+))?\s*(?:--[^\n]*)?$", text, re.M)
if not match:
return None
try:
value = float(match[1]) / float(match[2] or 1)
return value if math.isfinite(value) and value > 0 else None
except (ValueError, ZeroDivisionError):
return None


def logical_width(monitors):
widths = []
for monitor in monitors:
if monitor.get("disabled") or not re.match(r"^(DSI|eDP|Unknown)-", monitor.get("name", "")):
continue
try:
width = min(float(monitor["width"]), float(monitor["height"])) / float(monitor["scale"])
if math.isfinite(width) and width > 0:
widths.append(width)
except (KeyError, TypeError, ValueError, ZeroDivisionError):
continue
return min(widths) if widths else None


def geometry(config):
# Live compositor data honours the user's scale and works on simpledrm.
try:
result = subprocess.run(["hyprctl", "monitors", "-j"], capture_output=True, text=True, check=True, timeout=2)
width = logical_width(json.loads(result.stdout))
if width:
return width
except (OSError, subprocess.SubprocessError, ValueError, TypeError, AttributeError):
pass
# Firstboot runs before Hyprland. Read the numeric scale setup-user seeded;
# never execute Lua to find it. Unknown/auto scales wait for a live session.
try:
scale = monitor_scale((config / "hypr/monitors.lua").read_text())
if scale:
drm = Path(os.environ.get("OMAMOBILE_DRM", "/sys/class/drm"))
widths = []
for modes in sorted(drm.glob("card*-*/modes")):
if not re.match(r"card\d+-(DSI|eDP|Unknown)-", modes.parent.name):
continue
match = re.match(r"(\d+)x(\d+)", modes.read_text())
if match:
widths.append(min(int(match[1]), int(match[2])) / scale)
return min(widths) if widths else None
except (OSError, ValueError):
pass
return None


def factor_for(width):
# Use Grok Bot's established 578 px layout for both Chromium and Electron,
# above their minimum widths. Keep the reference phone's 0.83 cap:
# 480 px -> 0.83, 405 px -> 0.70, 360 px -> 0.62. Site zoom is separate.
return f"{math.floor(min(0.83, width / 578) * 100) / 100:.2f}"


def browser_major(program):
try:
version = subprocess.run([program, "--version"], capture_output=True, text=True, check=True, timeout=2).stdout
match = re.search(r"\b(\d+)\.", version)
return match[1] if match else "153"
except (OSError, subprocess.SubprocessError):
return "153" # Historical first-login fallback; never query on later logins.


def parse_flags(source):
# Comments start at unquoted token boundaries; URL fragments stay literal.
text = []
quote = None
escaped = False
token = False
comment = False
for char in source:
if comment:
if char != "\n":
continue
comment = False
if escaped:
escaped = False
elif quote:
if char == quote:
quote = None
elif char == "\\" and quote == '"':
escaped = True
elif char == "#" and not token:
comment = True
continue
elif char in " \t\r\n":
token = False
else:
token = True
if char in "'\"":
quote = char
elif char == "\\":
escaped = True
text.append(char)
# Validate quotes/escapes and group argv without evaluating shell code.
return shlex.split("".join(text), comments=False, posix=True)



def configure(path, factor, done, program):
chromium = program == "chromium"
marker = done / ("omamobile-browser-fit-" + program)
if marker.exists():
return
if not chromium and factor is None:
return # Grok has only a geometry-dependent scale default.
defaults_marker = done / "omamobile-browser-defaults-chromium"
before = path.read_text() if path.exists() else ""
flags = parse_flags(before)
has = lambda key: any(flag.split("=")[0] == key for flag in flags)
prior = lambda name: (done / ("omamobile-" + name)).exists()
scale_marked = (prior("chromium-scale-2") or prior("chromium-scale-3")) if chromium else prior("grok-bot-fit")
scale_flags = [f for f in flags if f.startswith("--force-device-scale-factor=")]
after = before
if factor is not None and scale_marked and scale_flags == ["--force-device-scale-factor=0.83"]:
# Only the exact unquoted line written by historical setup. Custom
# values, quoted overrides and a deliberately deleted scale stay put.
after = re.sub(r"^--force-device-scale-factor=0\.83$", f"--force-device-scale-factor={factor}", after, flags=re.M)
additions = []
if factor is not None and not scale_marked and not has("--force-device-scale-factor"):
additions.append(f"--force-device-scale-factor={factor}")
if chromium and not defaults_marker.exists():
for name, defaults in (
("chromium-no-first-run", ("--no-first-run",)),
("chromium-wayland-ime", ("--enable-wayland-ime", "--wayland-text-input-version=3")),
):
if not prior(name):
additions.extend(flag for flag in defaults if not has(flag.split("=")[0]))
if not prior("chromium-mobile") and not has("--user-agent"):
# Do this only immediately before writing a missing, once-only UA.
major = browser_major(program)
additions.append(shlex.quote(f"--user-agent=Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{major}.0.0.0 Mobile Safari/537.36"))
if additions:
after += ("\n" if after and not after.endswith("\n") else "") + "\n".join(additions) + "\n"
if after != before:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(after)
done.mkdir(parents=True, exist_ok=True)
if chromium:
defaults_marker.touch()
if factor is not None:
marker.touch()


def main():
config = Path.home() / ".config"
done = Path.home() / ".local/state/omarchy/done"
programs = (("chromium", "chromium-flags.conf"), ("grok-bot", "grok-bot-flags.conf"))
if all((done / ("omamobile-browser-fit-" + program)).exists() for program, _ in programs):
return # No geometry or browser process at subsequent logins.
width = geometry(config)
# UA, input method and first-run defaults do not need geometry. The bar
# retries at shell start, with live compositor data, for computed/auto Lua
# scales. Their separate marker preserves removals before that retry too.
factor = factor_for(width) if width and width >= 128 else None
for program, filename in programs:
try:
configure(config / filename, factor, done, program)
except (OSError, ValueError) as error:
print(f"omamobile-browser-setup: {filename}: {error}", file=__import__("sys").stderr)


if __name__ == "__main__":
main()
Loading