Skip to content

Install the Mac battery mirror through VM integrations - #252

Merged
themartiano merged 2 commits into
omacom:mainfrom
NimbleAINinja:battery-integration
Sep 23, 2026
Merged

themartiano merged 2 commits into
omacom:mainfrom
NimbleAINinja:battery-integration

Conversation

@NimbleAINinja

Copy link
Copy Markdown
Contributor

What changed and why

Existing VMs keep their disk across app updates, so after #220 they get the battery port but not the guest module and bridge. The only way to add them has been to stage eight repo files through the shared folder and run install-battery-into-existing-guest.sh by hand. The VM integrations manager from #193 already delivers reviewed guest features to existing VMs, so this delivers the battery through it. VM integrations → Review… now installs the Mac battery mirror along with sudo Touch ID support.

  • Bundle: adds the retrofit script, the three DKMS sources and the five bridge/udev/module-load/UPower files. The updater runs the script with --source pointing at the staged, verified bundle.
  • Already installed: the managed files include the DKMS sources at the factory package's path (/usr/src/try-omarchy-battery-1.0.0/), so a guest built with the battery reports current. When the files are current and dkms status shows the module built for the running kernel, installation records the component without rerunning the script, leaving the package-owned files untouched.
  • Can't build here: the module needs DKMS and headers for the running kernel. Images before v0.3.0 have neither, and after a kernel update the headers match the new kernel until a restart. In those cases the battery reports disabled instead of repair, the review names the reason, and installation skips it without failing Touch ID.
  • Mac side: GuestIntegrationReport rejected any report naming a component outside its allowed list, and treated anything beyond bootstrap/sudo as "use matching app". It now accepts battery as a supported component, so a guest with the earlier sudo-only bundle is offered the update and a guest with the battery reports up to date.
  • Docs: docs/host-battery.md now points to VM integrations for retrofitting, keeping the shared-folder route as a fallback; docs/integration-updates.md and the README list the battery.

Testing

  • make test: passed. New Python tests cover: the bundle carrying every file the installer stages; the version and path matching the factory DKMS package; disabled versus repair status; each unavailable reason; the installer running from the staged bundle; skipping an unbuildable battery; and keeping an installed one without rerunning the script. New Swift tests cover decoding and summarising reports that include battery, and offering the update to a sudo-only guest.
  • git diff --check: clean.
  • Built the full app with make build from this commit (fresh guest image; the guest build needed a local-only package-lock refresh because Arch Linux ARM has moved past several pins on main, which is not part of this PR).
  • Manual, on an M1 Max MacBook Pro, with an existing VM created before VM integrations whose battery had been installed by hand with the retrofit script:
    • The launcher's Review VM integrations offered the setup command. Running it in an Omarchy terminal opened the review, which listed Touch ID support and the Mac battery as installed.
    • Install/update integration support completed with "Integrations installed and checked.", and the battery meter stayed in the bar. A second run reported sudo: already verified; retained. and battery: already verified; retained.
    • The launcher's VM integrations status then showed "Last check: Up to date. Checked again after each VM launch."
  • Not checked on a real VM: a first battery install on a VM without it, the disabled path (image before v0.3.0, or a kernel update without a restart), and a fresh image reporting up to date without setup. These are covered by the unit tests above.
  • The updated dialog wording ("…sudo Touch ID support and the Mac battery mirror…") compiles and passes the tests, but the build tested above had the previous wording.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HTMdXGJ5j4UcAVdNtQLW4y

NimbleAINinja and others added 2 commits September 22, 2026 18:00
Existing VMs keep their disk across app updates, so they get the battery
port but not the guest module and bridge from omacom#220. The only way to add
them was to stage eight repo files through the shared folder and run the
retrofit script by hand. The VM integrations manager already delivers
reviewed guest features to existing VMs, so deliver the battery with it.

Add a battery component to the integration bundle. It carries the
retrofit script, the DKMS sources and the bridge files, and runs the
script with --source pointing at the staged bundle. The managed files
include the DKMS sources at the factory package's path, so a guest built
with the battery already reports current. When the files are current and
the module is built for the running kernel, installation records the
component without rerunning the script, leaving package-owned files
alone.

The module needs DKMS and headers for the running kernel. Images before
v0.3.0 have neither, and after a kernel update the headers match the new
kernel until a restart. In those cases the component reports disabled
rather than repair, the review names the reason, and installation skips
it without failing the other integrations.

The host accepted only bootstrap and sudo as components it installs, and
rejected a report naming battery as invalid. Accept battery and treat it
as supported, so a guest with the earlier sudo-only bundle is offered the
update and a guest with battery reports up to date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HTMdXGJ5j4UcAVdNtQLW4y
@themartiano
themartiano merged commit 28f4722 into omacom:main Sep 23, 2026
2 checks passed
@NimbleAINinja
NimbleAINinja deleted the battery-integration branch September 23, 2026 10:07
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