6 Commits
Author SHA1 Message Date
Joachim HummelandClaude Opus 4.7 a6cdad5082 Fix battery tray icon vanishing after boot
The wait loop polled QSystemTrayIcon.isSystemTrayAvailable(), but Qt5
caches that value from the moment QApplication is constructed. At login
the autostart wins the race against wf-panel-pi's tray, so Qt caches
"no tray" permanently, the loop never escapes, and the process hangs
until the 120s timeout and exits.

Add wait_for_tray(), which polls the session bus directly (dbus-send
NameHasOwner for org.kde.StatusNotifierWatcher) before QApplication is
constructed, so Qt reports the tray correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 23:16:39 +02:00
Joachim HummelandClaude Opus 4.7 500a939db4 Fix DKMS build using the wrong kernel version
The DKMS Makefile built against /lib/modules/$(uname -r), the *running*
kernel. When DKMS rebuilds the module for a newly installed kernel (the
common case after an apt upgrade, while the old kernel is still running),
it produced a .ko with the old kernel's vermagic and installed it into
the new kernel's tree. The module then failed to load with "disagrees
about version of symbol module_layout".

Make the Makefile honour a KVERSION variable (defaulting to the running
kernel for manual builds) and have dkms.conf pass DKMS's target kernel
via KVERSION=${kernelver}, so the module is always built for the kernel
it is being installed for.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 23:07:17 +02:00
Joachim HummelandClaude Opus 4.7 2e65dadfa9 Add low-battery warning and auto-shutdown to the tray icon
The oneUpPower kernel module powered the system off at low SOC, but the
icon now reads the battery over I2C and no longer relies on that module.
Restore the safety net in the icon itself.

While running on battery, warn via a tray notification at <=10% and run
`systemctl poweroff` at <=5%. systemctl poweroff is authorised for the
active desktop session without sudo (logind CanPowerOff returns "yes").
State resets when AC is reconnected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 23:03:54 +02:00
Joachim HummelandClaude Opus 4.7 19f1e2962e Read battery state over I2C instead of the kernel module
batteryIcon.py read SOC and AC status from /sys/class/power_supply,
which only exists when the oneUpPower kernel module is loaded. When the
module fails to load (e.g. a DKMS vermagic mismatch after a kernel
update), the icon showed only "N/A".

Read the battery IC directly over I2C (bus 1, addr 0x64, regs 0x04 and
0x0E -- the same registers oneUpPower.c uses) via smbus2. force=True
bypasses the I2C_SLAVE busy check so the read still works whether or not
the kernel module has claimed the address. The icon now works for an
ordinary user in the i2c group, with no sudo and no kernel module.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 22:58:20 +02:00
Joachim HummelandClaude Opus 4.7 8b092d0ca6 Add CLAUDE.md with project guidance
Document the project overview, build commands, and architecture
for the oneUpPower kernel module and oneUpMon monitor app.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 22:31:33 +02:00
Joachim HummelandClaude Opus 4.7 462dc2d380 Add battery tray icon with reliable autostart
Add batteryIcon.py, a PyQt5 system tray icon for the Argon ONE UP
that shows battery SOC and charging status, plus an XDG autostart
entry (batteryIcon.desktop).

The icon now waits up to 120s for the system tray to become
available instead of exiting immediately. At login the autostart
entry runs before the labwc panel (wf-panel-pi) provides its tray,
which previously caused the script to sys.exit(1) and the icon to
be missing after every reboot.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 22:31:12 +02:00