Skip to content

omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size - #635

Open
jkjoplin wants to merge 1 commit into
derekross:mainfrom
jkjoplin:display-scale-per-output
Open

jkjoplin wants to merge 1 commit into
derekross:mainfrom
jkjoplin:display-scale-per-output

Conversation

@jkjoplin

Copy link
Copy Markdown
Contributor

What and why

One monitor scale of 3 for every phone only suits the Pixel 7 Pro. At 3, the Pixel 9a's 1080x2424 panel (422 px/in) came out 360 px wide, so its UI was 21% larger than the 7 Pro's. The Pixel 8 Pro's 2992 px don't divide by 3, so Hyprland moved it to 3.2, with a warning. Several shell rules also assumed a 480-px-wide screen.

This PR works out each screen's scale from its mode and the millimetres DRM reports (Hyprland 0.57's Lua exposes physical_width/physical_height for every monitor). The UI then comes out the same physical size on every phone, including boards that aren't supported yet.

Phone Panel px/in Scale Logical UI vs 7 Pro
Pixel 7 Pro 1440x3120, 71x155 mm 512 3 480x1040 100% (unchanged)
Pixel 9a 1080x2424 422 2.4 450x1010 97%
Pixel 8 Pro 1344x2992, 70x155 mm 489 8/3 504x1122 93%
  • hypr/display-scale.lua (new):
    • A DSI panel gets the 7 Pro's 170.7 logical px per inch.
    • An external screen gets 110 px/in; a screen of unknown size gets 1.
    • Each is snapped to the nearest k/120 that divides the mode into whole logical pixels, which is all Hyprland accepts.
    • A built-in panel that reports 0x0 mm keeps the fallback 3.
  • How it's loaded: omamobile-setup-user loads the module at the top of monitors.lua, once, and only while the scale is still a default ("auto" or 3). A 9a's 8/3 from 0.2.35-0.2.115, and any user's own value, stay.
  • The panel: its scale goes through omarchy_monitor_scale, and GDK_SCALE follows it, rounded up. Other outputs get rules of their own.
  • What still wins: a number in omarchy_monitor_scale, or a rule for one output further down (Omarchy's display scaling writes one).
  • Modes are never changed:
    • The module makes no rule for the panel.
    • Its rules for other outputs keep the mode each output already has.
    • The setup changes only the two local lines of monitors.lua.
    • A user's own rule, such as a 60 Hz mode for the battery, is left byte-for-byte as it is.
  • Why not hyprctl eval at runtime: a rule set that way is dropped at the next config reload, which Omarchy causes often, so the scale would jump back and forth. Everything here comes from the config.
  • Cold start: Hyprland reads the config before it has any outputs. A panel whose scale isn't the fallback 3 therefore costs one hyprctl reload when it appears (none on the 7 Pro). An output plugged in later costs one too.
  • omamobile-display-scale (new, read-only): shows the numbers for every output, or for a panel given as W H MMW MMH.
  • No more fixed 480 px:
    • Picture-in-picture is 62.5% of the screen's shorter side wide (still 300x169 on the 7 Pro).
    • The home screen's geometry defaults come from the screen.
    • Comments that took 480 px for every phone now say which phone they mean.
  • The cost of a fractional scale (package README): a client without wp-fractional-scale-v1 (GTK 3 apps, squeekboard) draws at 3, and Hyprland scales it down. On the 9a that is 1.56 times the panel's pixels. X11 apps come out up to 25% larger than the rest.
  • CI now installs lua. Without it, every Lua test (phone-rules.lua included) was being skipped.

For the maintainer to decide:

  1. A new 9a user gets 2.4 instead of the owner's 8/3 (device/tegu NOTES, 2026-10-25). A 9a that is already set up keeps 8/3.
  2. An 8 Pro still on the seeded 3 moves to 8/3. Hyprland had been bumping it to 3.2, so the UI gets about 17% smaller there.
  3. Grok Bot's scale factor on a new 9a becomes 0.62 (was 0.70). omamobile-setup-user works it out before the compositor runs, so it uses scale 3. The window still fits.

Device and build

  • Phone: none booted into this build. The read-only checks below ran on a Pixel 7 Pro (cheetah).
  • Kernel release (uname -r): 7.3.0-rc6-omamobile-g2219cc6cda77 (the phone the read-only checks ran on)
  • Packages changed, with versions: omamobile-shell 0.2.116

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes. On the phone I worked on, it stops at tests/kernel-pr-check ("the kernel config doesn't configure"), which fails the same way on main there. That's the environment, not this change. tests/pr-check, tests/tools-help and tests/grep-q-pipes pass on their own. CI runs the whole suite.
  • tests/packages passes (or the packages I touched: omamobile-shell test/all, 310 checks, nothing skipped)
  • Each changed package has its version bumped, and the new version is in the commit subject
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

What the tests cover:

  • test/display-scale.lua (new, on Lua 5.4, 5.5 and LuaJIT):
    • the scale sums for the three phones, with a millimetre either way of each;
    • external and headless screens, and bogus sizes;
    • every result checked against a copy of Hyprland 0.57's own scale check and rule order;
    • the 60 Hz rules (with a number, and with omarchy_monitor_scale), at a reload and on a cold start;
    • a Hyprland whose API has moved on.
  • test/setup-user.sh:
    • the step on Omarchy's template and on this package's earlier layout, with each result evaluated under Hyprland's rules;
    • a 9a already on 8/3 left untouched;
    • a monitors.lua that is a symlink;
    • a user's 60 Hz rules left byte-identical.
  • test/phone-rules.lua: the picture-in-picture size at 480, 450, 504 and 360 px wide, and on its side.

On the phone

  • I ran this on my own phone, booted into this build

  • Runbook steps passed (plan, step, result): none run yet. The runbook is below.

  • What I did not test:

    • the module in a live Hyprland;
    • a cold start on a 9a or 8 Pro (where the one reload happens);
    • the setup step on a real login.

    Only read-only checks ran, on the 7 Pro: hyprctl monitors -j and Hyprland's Lua report DSI-1 at 1440x3120 and 71x155 mm, and omamobile-display-scale gives it 3.

  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)

Runbook for a phone. Steps 3 and 4 restart the session or reload the config, so announce them first.

  1. Read-only: omamobile-display-scale shows DSI-1's expected scale.
  2. Install, log in: after installing the package and logging in again, ~/.config/hypr/monitors.lua starts with the module's block, and the two local lines read omamobile_display.monitor_scale(3) and omamobile_display.gdk_scale(3).
  3. Cold start:
    • Restart the session.
    • 7 Pro: scale 3, and no hyprctl reload from the module.
    • 9a: one reload, then 2.4.
    • 8 Pro: one reload, then 2.6667.
    • The mode stays whatever the user's rule sets (60 Hz if pinned).
  4. Reload: after a manual hyprctl reload, nothing changes.
  5. Rollback: delete the block and put back local omarchy_monitor_scale = 3 and local omarchy_gdk_scale = 3.
tools/phone-smoke report

Not attached: no phone has been booted into this build yet.

🤖 Generated with Claude Code

One monitor scale of 3 for every phone only suits the Pixel 7 Pro
(1440x3120 at 512 px/in: 480x1040 logical). The Pixel 9a's 1080x2424
at 422 px/in came out 360 px wide, its UI 21% larger, and the Pixel 8
Pro's 2992 px don't divide by 3: Hyprland moved it to 3.2, with a
warning.

hypr/display-scale.lua works each screen's scale out from its mode and
the millimetres DRM reports, which Hyprland 0.57's Lua has for every
monitor: a DSI panel gets the 7 Pro's 170.7 logical px per inch, an
external screen 110, one of unknown size 1, snapped to the nearest
k/120 that divides the mode into whole logical pixels. That is 3 on the
7 Pro (480x1040), 2.4 on the 9a (450x1010, the UI at 97% of the 7 Pro's
size) and 8/3 on the 8 Pro (504x1122, 93%); a phone not yet supported
gets its scale the same way. omamobile-setup-user loads it at the top
of monitors.lua, once, while the monitor scale is still a default
("auto" or 3; a 9a's 8 / 3 from 0.2.35 and any user's own value stay).
The panel's scale goes through omarchy_monitor_scale, so a rule that
copies Omarchy's line (the reference 7 Pro has a 60 Hz one) keeps it,
GDK_SCALE follows it rounded up, and other outputs get rules of their
own, each in the mode that output already has. A number there, or a
rule for one output further down (Omarchy's display scaling writes one),
still wins. No mode changes: the module makes no rule for the panel,
setup-user changes only monitors.lua's two `local` lines, and a user's
own rule (a 60 Hz mode for the battery) is left exactly as it is.

The rules come from the config rather than from `hyprctl eval` at run
time: a runtime rule is dropped at the next config reload, which Omarchy
causes often, and the scale would jump back and forth. On a cold start
Hyprland reads the config before it has any outputs, so a panel whose
scale isn't the fallback 3 costs one `hyprctl reload` when it appears
(none on the 7 Pro), as does an output plugged in later.

omamobile-display-scale shows the numbers, read-only. Picture-in-picture
is 62.5% of the screen's shorter side wide (300x169 on the 7 Pro), the
home screen's geometry defaults come from the screen, and the comments
that took 480 px for every phone say which phone they mean. The README
has the cost of a fractional scale: a client without
wp-fractional-scale-v1 (GTK 3, squeekboard) draws at 3 and Hyprland
scales it down, 1.56 times the panel's pixels on the 9a.

For the maintainer: a new 9a user gets 2.4 rather than the owner's 8/3
(device/tegu NOTES, 2026-10-25), and an 8 Pro still on the seeded 3
moves to 8/3. Grok Bot's factor on a new 9a is 0.62 (0.70 before):
setup-user works it out before the compositor runs, at 3. CI now
installs lua, so the Lua tests run there (phone-rules.lua was skipped
too).

Tested: omamobile-shell's test/all, with display-scale.lua's sums and
rules on Lua 5.4, 5.5 and LuaJIT against Hyprland 0.57's own scale check
and rule order, and the monitors.lua setup-user writes from Omarchy's
template and from this package's earlier one; tests/grep-q-pipes. On
the 7 Pro (7.3.0-rc6-omamobile-g2219cc6cda77), read-only: hyprctl and
Hyprland's Lua report DSI-1 at 1440x3120 and 71x155 mm, and
omamobile-display-scale gives it 3. Not run on a phone: the module in a
live Hyprland, a cold start on a 9a or an 8 Pro.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thanks, @jkjoplin. The module is well thought through: doing it in the config rather than with hyprctl eval so a reload can't undo it, leaving an existing 9a's 8/3 and any user's own value alone, never touching a mode, keeping a 60 Hz rule byte for byte, the fallback for a panel that reports no size, and tests that check every result against Hyprland's own scale rule. I checked the API against the Hyprland 0.57.0 source we build and it's all there, and I re-did the sums: with the 71x155 mm our panel driver reports, the 7 Pro comes out at 3 for any size within 2 mm, and the 9a's driver (64x145 mm, not the 65x146 in the table) gives 2.4. Finding that CI had been skipping every Lua test is a good catch too.

Three things before it can land, and a few I have to decide.

1. Please guard the module's load. The line the setup step writes into the user's monitors.lua is a bare dofile(...).setup(). If the file isn't there, monitors.lua stops at its first statement: no monitor rule, no GDK_SCALE, and Hyprland falls back to its own default, which is scale 2 on a panel this dense, with the error bar. That happens on any phone that goes back to an earlier omamobile-shell (my test phone does that every time I install another branch), and the step is once-only, so nothing takes the line out again. Something like

local ok, m = pcall(dofile, "/usr/share/omamobile/shell/hypr/display-scale.lua")
local omamobile_display = ok and m.setup() or { monitor_scale = function(f) return f end, gdk_scale = function(f) return f end }

and a case in test/setup-user.sh that evaluates the generated file with the path pointing nowhere would settle it.

2. The version. Main took 0.2.116 and 0.2.117 this afternoon, and #636 says 0.2.116 too. I'll set the number at merge, so no need to renumber; but the number is also in the text this adds to AGENTS.md (twice) and in the "0.2.35-0.2.115" comment, so please write those so they don't depend on it, or I'll fix them when I merge.

3. It needs to run on phones first. This changes what every phone's session does at start, and nothing has run in a live Hyprland yet. I'll do the 7 Pro myself once the guard is in (install, log in, cold start with no reload, a manual reload, rotation, picture-in-picture, then back to main's package to check the guard). For the other two, could you or the owners post one cold start each on a 9a and an 8 Pro: hyprctl monitors -j after login, how many reloads the module caused, and a screenshot? The "starts at 3, reloads once to 2.4" path is the part the stub can't show, and I'd like to see how visible that re-layout is, since it happens at every login.

Smaller things: the picture-in-picture height is now 168.75 on the 7 Pro rather than 169 (rint() would keep it exact); and a user who set a scale through Omarchy's display scaling gets, as far as I can read check(), one pointless reload per cold start, because the panel's scale never equals the computed one.

What I need to decide, and your view is welcome:

  • The 9a's default. Its owner chose 8/3 on the phone; 2.4 is 10 % smaller and nobody has looked at it there. I'd like the owner to try both before the default changes.
  • Existing users on other phones. The step applies to anyone whose line still reads 3, so an 8 Pro gets 17 % smaller at the next login, and so does any other phone whose panel driver happens to report a size. Could you add a table for the phones in DEVICES.md: the panel driver, the millimetres it reports on omamobile, and the scale before and after? I may limit the step for existing users to phones whose owner has confirmed the result.
  • Grok Bot on a new 9a. 0.62 is worked out for 360 px while the panel will be 450 px wide, so its layout comes out about 726 px wide, a fifth smaller than intended. omamobile-shell: share once-only Chromium and Grok fitting #581 reworks the same fitting and reads the scale line as a number, which this PR turns into a function call, so the two need to agree; I'll sort out the order with both of you.
  • External and headless outputs now get their scale from the module on every phone. I think that's fine, but it's a second change in the same PR.

kdegeek added a commit to kdegeek/omarchy-mobile-fork that referenced this pull request Nov 18, 2026
…licy

The first comet submission after issue derekross#143: the descriptor, curated
hardware observations, the remaining gates and an inert boot-policy
package.

Boot-success stays off: the package ships no boot-success script, unit or
devinfo writer and enables nothing, and status, install and README agree.
SOC_COMPATIBLE stays commented out, as on tegu, so install-phone and flash
refuse comet until the public board DTB lands. The storage guard allows
only the five slot-B boot images and userdata.

NOTES records the 2026-11-07 stock restore (CP3A.261005.005 on both
slots), the commands that put Linux back on slot B, the slot-B marking
and the fresh protected backup, and marks the 2026-10-30 slot-state
paragraphs as historical. BRINGUP-M1 writes out both recovery
procedures as fastboot commands now that slot A is a live stock
fallback.

The package starts at 0.1.0. It no longer depends on omamobile-shell and
the descriptor drops MONITOR_SCALE (the panel-size scale is derekross#635's job).
The AoC blacklist names the modules the comet zumapro kernel builds,
not gs201's. reboot-to.c follows cheetah's current copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kdegeek added a commit to kdegeek/omarchy-mobile-fork that referenced this pull request Nov 18, 2026
…licy

The first comet submission after issue derekross#143: the descriptor, curated
hardware observations, the remaining gates and an inert boot-policy
package.

Boot-success stays off: the package ships no boot-success script, unit or
devinfo writer and enables nothing, and status, install and README agree.
SOC_COMPATIBLE stays commented out, as on tegu, so install-phone and flash
refuse comet until the public board DTB lands. The storage guard allows
only the five slot-B boot images and userdata.

NOTES records the 2026-11-07 stock restore (CP3A.261005.005 on both
slots), the commands that put Linux back on slot B, the slot-B marking
and the fresh protected backup, and marks the 2026-10-30 slot-state
paragraphs as historical. BRINGUP-M1 writes out both recovery
procedures as fastboot commands now that slot A is a live stock
fallback.

The package starts at 0.1.0. It no longer depends on omamobile-shell and
the descriptor drops MONITOR_SCALE (the panel-size scale is derekross#635's job).
The AoC blacklist names the modules the comet zumapro kernel builds,
not gs201's. reboot-to.c follows cheetah's current copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants