Skip to content

omamobile-shell 0.2.135: an optional device.lua after the shared phone rules - #204

Merged
derekross merged 3 commits into
derekross:mainfrom
kdegeek:shell-device-hook-scale
Nov 18, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
kdegeek:shell-device-hook-scale

Conversation

@kdegeek

@kdegeek kdegeek commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A phone with more than one panel, or input devices of its own, needs session settings that no other phone has. The Pixel 9 Pro Fold (comet, #203) has an inner and an outer screen. hypr/phone.lua now loads /usr/share/omamobile/hypr/device.lua after the shared rules when a device package installs one, so that package can carry those settings without a device branch in phone.lua.

  • The load runs under pcall. A syntax or runtime error in the device file is printed as omamobile: /usr/share/omamobile/hypr/device.lua: <error> (Lua print, so on Hyprland's output), and the shared rules stay in force.
  • With no device file nothing changes. No package on main installs one, so every phone today is unaffected.
  • Every session that loads phone.lua (setup-user adds it to looknfeel.lua once) gets the hook, for new and existing users alike.
  • The monitor-scale seed from the first version of this PR has been removed. Scale is left to omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size #635 and omamobile-setup-user is untouched.

This lands together with #203. Comet's own device.lua (its inner-panel touch mapping) follows as a small device-comet change once both are in.

Device and build

Checks (no phone needed)

  • tools/pr-check upstream/main passes
  • tests/all: not run for this change. It touches only omamobile-shell, and tests/packages for that package is below.
  • packages/omamobile-shell/test/all in the Arch Linux ARM build container, with lua installed: passes, except test/power-overlap.sh (the last test in the file), which fails the same way on unchanged main in this container, as a timing failure under arm64 emulation. In one earlier run test/sleepd.sh timed out too; it passes when run alone, on main and on this branch
  • test/phone-rules.lua with DEVICE_HOOK_CASE unset, valid, syntax and runtime: all pass. The device file runs only when valid, and every shared-rule check still passes.
  • The version is bumped, and the new version is in the commit subject
  • The commit has an area prefix and a body that says why; the AI help is a Co-Authored-By: trailer

On the phone

  • Not run on a phone in this form. What I did not test: a Hyprland session loading a broken device.lua. The test covers this under the Lua stub of Hyprland's API, not in a live session.
  • Nothing here writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace.

🤖 Generated with Claude Code

@derekross

Copy link
Copy Markdown
Owner

Thanks, Nate. The hook is small and leaves every current phone alone. Please rebase onto main (the shell is at 0.2.45 and the next few numbers are taken by open PRs, so take the next free version when it's ready), wrap the dofile in pcall so a broken device file can't break phone.lua, and let's land it together with the comet package that uses it (#203).

@derekross

Copy link
Copy Markdown
Owner

A friendly check-in: this has been quiet for over a week and now conflicts with main. If you'd like to continue, a rebase onto main will get it reviewed again. If I don't hear back within a week I'll close it to keep the queue tidy; it can be reopened any time.

@kdegeek

kdegeek commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Still active. I'm rebasing this onto main now. As you asked, it lands together with the comet board DTS, which I'm rebasing onto the zumapro stack that came in with linux-omarchy-mobile#187.

kdegeek added a commit to kdegeek/omarchy-mobile-fork that referenced this pull request Nov 11, 2026
Keep the initial Comet descriptor, recovery record and boot policy separate
from the daily integration package. Follow current main for shared USB,
mirrorlist, repository hook and reboot-to files. No hardware service starts
on installation and no devinfo writer or boot-success unit is shipped.
Install, status and README consistently keep boot-success disabled under
the maintainer's issue derekross#143 policy.

Leave SOC_COMPATIBLE commented out, as tegu does, so install-phone and
flash refuse comet until the public board DTB lands: comet has no stock
slot to fall back to. The package depends on omamobile-shell without a
version; the descriptor scale it reads comes with derekross#204.

Public board DTS and module sources, an exact candidate build and an owner
smoke report remain prerequisites. The notes label older private-kernel
evidence.

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

Copy link
Copy Markdown
Owner

Thanks, Nate, and good to hear it's still active. Nothing new has arrived on this branch yet, so my points from 10-31 stand. Since the base is now two weeks old, here is what the rebase will meet:

  1. The scale seed on main has changed. omamobile-setup-user now starts from 3 and uses 8/3 on the Pixel 9a (picked by the board's compatible), and the GDK step right below it only acts while the monitor scale is exactly 3. Whatever you add has to leave the 7 Pro at 3 and the 9a at 8/3. No descriptor on main sets MONITOR_SCALE, so "the descriptor's value if there is one, otherwise what main does today" keeps both.
  2. Before you rebase the scale part, please look at omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size #635. It works the scale out from each panel's mode and physical size, for every phone. If that lands, a MONITOR_SCALE seed would be a second way to set the same value, and comet would get a sensible scale without it. I'd suggest cutting this PR down to the device.lua hook, which is the part nothing else provides, and we'll see after omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size #635 whether a foldable still needs a descriptor override.
  3. pcall around the dofile, as before: a broken device file should log an error and leave the shared rules standing.
  4. The version: the shell is at 0.2.125 on main, so take the next free number when it's ready, and drop the "Version 0.2.18:" from the README paragraph (the text is fine without it). Also python3 -B in test/all, as the other tests there use.

It still lands together with #203.

…e rules

A phone with more than one panel or its own input devices (the Pixel 9
Pro Fold's inner and outer screens) needs session settings no other
phone has. hypr/phone.lua now loads /usr/share/omamobile/hypr/device.lua
after the shared rules when a device package installs one, so that
package can carry them without a device branch in phone.lua.

The load runs under pcall: a syntax or runtime error in the device file
is printed (Lua's print, on Hyprland's output) and the shared rules
stay in force. With no device file nothing changes, so every phone on
main is unaffected.

test/phone-rules.lua loads the real phone.lua with that one path
redirected to a temporary file, and test/all runs it with a valid file,
a syntax error and a runtime error; the default run has none. Each case
checks the device file ran only when valid and the shared rules still
hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kdegeek
kdegeek force-pushed the shell-device-hook-scale branch from 096f8f2 to a5d5718 Compare November 18, 2026 02:00
@kdegeek kdegeek changed the title shell 0.2.18: load device settings and seed the device monitor scale omamobile-shell 0.2.134: an optional device.lua after the shared phone rules Nov 18, 2026
@kdegeek

kdegeek commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main (c462357) and cut down as you suggested. Point by point:

  1. Scale seed. Dropped. omamobile-setup-user is untouched, so the 7 Pro stays at 3 and the 9a at 8/3, and omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size #635 is the one place the scale comes from. If a foldable still needs a descriptor override after omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size #635, that will be its own PR.
  2. omamobile-shell 0.2.116: every phone's UI at the 7 Pro's physical size #635. This PR is now the device.lua hook only: hypr/phone.lua loads /usr/share/omamobile/hypr/device.lua after the shared rules if a device package installs one.
  3. pcall. The dofile runs under pcall. A syntax or runtime error in the device file is printed as omamobile: /usr/share/omamobile/hypr/device.lua: <error> (Lua print, so on Hyprland's output), and the shared rules stay in force. test/phone-rules.lua loads the real phone.lua with only that path redirected to a temporary file. test/all runs it with a valid file, a syntax error and a runtime error, and the default run has no file. Each case checks that the device file ran only when valid and that the shared rules' checks still pass.
  4. Version, README, python3 -B. The version is now omamobile-shell 0.2.134: main is at 0.2.133 and none of the open shell PRs claims a higher number. The README has a short "Device settings" section with no version in it. The scale test, the only Python this PR added to test/all, went out with the seed, so this PR adds no python3 calls. The new checks are the Lua ones above.

It still lands together with #203. Comet's own device.lua (its inner-panel touch mapping) will follow as a small device-comet change once both are in.

@derekross

Copy link
Copy Markdown
Owner

Thanks, Nate. This is exactly the cut I asked for, and it is ready as far as the code goes. The scale seed is gone and omamobile-setup-user is untouched, so the 7 Pro and the 9a keep their scales and #635 stays the one place a scale comes from. The hook runs under pcall, and the test holds it to that: I ran test/phone-rules.lua with no device file and with your three cases and all pass, and when I take the pcall out the syntax and runtime cases fail, and when I delete the hook the valid case fails. With no device file the block opens a path that isn't there and does nothing, and it uses only calls the session already makes (phone.lua already has io.open and pcall, and Omarchy's own dictation file loads an optional file the same way), so I don't need a phone run for it.

Two things are left, both on my side:

  • CI hasn't run on this pull request yet because it waits for my approval as a first contribution. I'll approve it; it needs to be green before I merge.
  • The version. 0.2.134 is right against main today, but three other open pull requests set the same number, and since the lines are identical git won't flag it. I set versions at merge, so there is nothing for you to do: if another one lands first I'll push the next free number to your branch before the squash.

It no longer depends on #203 for anything, so I may merge it ahead of it. Comet's own device.lua can then come with the device package when that is ready. One thought for that later change: an error in a device file is only printed to Hyprland's output today, where its owner won't see it; a notification might be kinder.

Somnius added a commit to Somnius/omarchy-mobile that referenced this pull request Nov 18, 2026
A Hyprland screen shader, pow(rgb, 1.55) then x0.88, from blind rounds by
eye on the 8 Pro's panel. The cause of the flat mid-tones is unknown, so
this is a stopgap. It is set from /usr/share/omamobile/hypr/device.lua,
which the phone.lua hook from derekross#204 loads; this depends on derekross#204. It is off
by default: ~/.config/omamobile/screen-look-on turns it on, and without
it device.lua doesn't call hl.config. glslang and lua become checkdepends
for the test.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI ran on this head and both jobs pass, your device.lua case among them.

One thing changed since my comment this morning: another pull request took omamobile-shell 0.2.134 on main a little later, so yours now needs 0.2.135. As I said, that one is mine: I'll merge main into your branch, set the version, retitle the pull request and merge once CI is green on that push. Nothing is needed from you.

derekross and others added 2 commits November 18, 2026 13:12
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@derekross derekross changed the title omamobile-shell 0.2.134: an optional device.lua after the shared phone rules omamobile-shell 0.2.135: an optional device.lua after the shared phone rules Nov 18, 2026
@derekross
derekross merged commit 17f9a3c into derekross:main Nov 18, 2026
2 checks passed
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