Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/omamobile-device-husky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename hu
| `vendor/modprobe.d/omamobile-max77759.conf` | `/usr/lib/modprobe.d` | Keeps max77759_charger, gpio_max77759, nvmem_max77759 and tcpci_maxim from autoloading: binding the PMIC creates the charger cell, which programs charge limits from the battery node. Blacklist only, so a runbook can still load them by hand. The fuel gauge and the MFD core are not blacklisted |
| `vendor/systemd/system/plymouth-quit.service.d/10-omamobile-retain-splash.conf` | `/usr/lib/systemd/system/plymouth-quit.service.d` | Makes `plymouth quit` keep its last frame on screen (`--retain-splash`) until Hyprland draws, instead of a black screen. The same three unit lines as cheetah and raven (the comments differ): gs-decon has no fbdev console to hand back, and on raven a plain quit hung for 27 s and held the session back. It only does anything with `splash` on the kernel command line, which husky's descriptor gets from #278; without it Plymouth never runs and the drop-in is inert. Booted from the package on a Pixel 8 Pro (2026-11-02, kernel 7.3.0-rc6-omamobile-push1-g5899fec2bd28): Plymouth started at 3.30 s and its quit, with --retain-splash, finished at 4.94 s without a hang |
| `bin/omamobile-bt-addr` + `vendor/systemd/system/omamobile-bt-addr@.service` + `vendor/udev/rules.d/80-omamobile-bt-addr.rules` | `/usr/bin`, `/usr/lib/systemd/system`, `/usr/lib/udev/rules.d` | Gives the BCM4398 its real Bluetooth address from the bootloader's device tree (`/chosen/config/bt_addr`) when the controller appears, powering it on once first, as on the Pixel 9a. The 9a's script, rule and unit with the chip named; the test checks. Without it the controller keeps its placeholder (43:98:D0:..), the same on every 8 Pro. The address is read at run time and never stored in the package. Bluetooth then comes up powered at every boot |
| `charge-limit.conf` + `vendor/udev/rules.d/75-omamobile-charge-limit.rules` + `vendor/systemd/system/omamobile-charge-limit-apply.service` | `/usr/share/omamobile/charge-limit.conf`, `/usr/lib/udev/rules.d`, `/usr/lib/systemd/system` (not enabled) | Declares that this phone has a charge limit on `max77759-charger` (`supply=max77759-charger`). The Settings app's Battery page and its root helper (omamobile-settings) need this file and do nothing without it, so no other phone gets the page whatever its kernel. When the charger appears, udev pulls in the apply unit, which runs the helper without an argument to put the saved `/etc/omamobile/charge-limit` back on the charger; no saved file, nothing is touched. Since 0.1.16. Inert while `omamobile-max77759.conf` blacklists `max77759_charger`: there is no charger power supply, and the Battery row stays hidden |
| `etc/omamobile-mirrorlist` | `/etc/pacman.d/omamobile-mirrorlist` | Where pacman finds the `[omamobile]` repository. Same file as the Pixel 7 Pro package |
| `omamobile-device-husky.install` | pacman hook | Adds `[omamobile]` to `pacman.conf` before `[omarchy]`, once. Same script as the Pixel 7 Pro package |
| `src/reboot-to.c` | `/usr/bin/reboot-to` | Reboot with a reason the bootloader understands. Same bytes as the Pixel 7 Pro package; the test checks |
Expand Down
6 changes: 6 additions & 0 deletions packages/omamobile-device-husky/charge-limit.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: MIT
# Declares that this phone has a charge limit, and on which power supply. The Settings app's Battery page
# (omamobile-settings: backends/charge.sh and the root helper charge-limit) does nothing on a phone without this
# file. Husky's max77759-charger has charge_control_end_threshold and charge_control_start_threshold on a kernel
# with derekross/linux-omarchy-mobile#266, once this package stops blacklisting max77759_charger.
supply=max77759-charger
6 changes: 6 additions & 0 deletions packages/omamobile-device-husky/install
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ ln -sfn ../omamobile-husky-aoc.service \
"$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-husky-aoc.service"
install -Dm644 vendor/modprobe.d/omamobile-husky-aoc.conf \
"$destination/usr/lib/modprobe.d/omamobile-husky-aoc.conf"
install -Dm644 charge-limit.conf \
"$destination/usr/share/omamobile/charge-limit.conf"
install -Dm644 vendor/udev/rules.d/75-omamobile-charge-limit.rules \
"$destination/usr/lib/udev/rules.d/75-omamobile-charge-limit.rules"
install -Dm644 vendor/systemd/system/omamobile-charge-limit-apply.service \
"$destination/usr/lib/systemd/system/omamobile-charge-limit-apply.service"
install -Dm644 device.conf \
"$destination/usr/share/omamobile/device.conf"
install -Dm644 etc/omamobile-mirrorlist \
Expand Down
8 changes: 8 additions & 0 deletions packages/omamobile-device-husky/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ for f in usr/bin/reboot-to \
usr/bin/omamobile-bt-addr usr/lib/systemd/system/omamobile-bt-addr@.service \
usr/lib/udev/rules.d/80-omamobile-bt-addr.rules \
usr/share/omamobile/device.conf \
usr/share/omamobile/charge-limit.conf \
usr/lib/udev/rules.d/75-omamobile-charge-limit.rules \
usr/lib/systemd/system/omamobile-charge-limit-apply.service \
usr/share/omamobile/device-husky/version \
usr/share/licenses/omamobile-device-husky/LICENSE \
etc/pacman.d/omamobile-mirrorlist; do
Expand Down Expand Up @@ -173,6 +176,11 @@ pass "install stages the udev rule, the USB link, the mirrorlist and the display
[[ ! -e $tmp/root/usr/lib/systemd/logind.conf.d/10-omamobile-lid.conf ]] \
|| fail "husky has no lid: no lid drop-in"
pass "no lid drop-in"
grep -qx 'supply=max77759-charger' "$tmp/root/usr/share/omamobile/charge-limit.conf" \
|| fail "husky declares its charge limit on max77759-charger"
[[ ! -e $tmp/root/usr/lib/systemd/system/multi-user.target.wants/omamobile-charge-limit-apply.service ]] \
|| fail "the apply unit is pulled in by udev, not enabled"
pass "the charge limit declaration, its udev rule and the apply unit are staged; the unit is not enabled"


# --- the AoC start: hang marker, nothing without the node ------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: MIT
# Applies the saved charge limit (/etc/omamobile/charge-limit) to the charger this package declares
# (/usr/share/omamobile/charge-limit.conf). Pulled in by udev when the charger appears
# (75-omamobile-charge-limit.rules); without a saved file the helper does nothing. The helper is omamobile-settings'.
# Not enabled.
[Unit]
Description=Apply the saved charge limit
StartLimitIntervalSec=0
After=local-fs.target
ConditionFileIsExecutable=/usr/lib/omamobile-settings/charge-limit

[Service]
Type=oneshot
ExecStart=/usr/lib/omamobile-settings/charge-limit
TimeoutStartSec=15
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: MIT
# Apply the saved charge limit (/etc/omamobile/charge-limit) when the MAX77759 charger appears, at every boot,
# through omamobile-charge-limit-apply.service rather than inside the udev worker. The helper acts only on the
# supply this package declares in /usr/share/omamobile/charge-limit.conf; no saved file: nothing is touched.
# No ACTION filter: with ACTION=="add" the device loses its systemd tag on the charger's next change event, and
# the unit did not start at boot on husky (2026-11-16); without it, it does.
SUBSYSTEM=="power_supply", KERNEL=="max77759-charger", TAG+="systemd", ENV{SYSTEMD_WANTS}+="omamobile-charge-limit-apply.service"
2 changes: 1 addition & 1 deletion packages/omamobile-device-husky/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.15
0.1.16
2 changes: 1 addition & 1 deletion packages/omamobile-settings/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkgdesc="Native mobile Settings framework and device information"
arch=(aarch64 x86_64)
url="https://github.com/derekross/omarchy-mobile"
license=(MIT)
depends=(omarchy bash brightnessctl python qt6-base qt6-declarative qt6-svg)
depends=(omarchy bash coreutils systemd brightnessctl polkit python qt6-base qt6-declarative qt6-svg)
makedepends=(gcc make)
checkdepends=(dbus python)

Expand Down
24 changes: 24 additions & 0 deletions packages/omamobile-settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ refresh rate changes the running session only: turning the phone makes
auto-rotate apply the monitor's preferred mode again, and a session restart or a
reload of Hyprland's config does too). The page runs
`backends/display.sh` through a fixed-argument runner, with no shell string.
A second page, Battery, sets the charge limit (80, 85, 90, 95 or 100 %), only
on a phone whose device package declares one in
`/usr/share/omamobile/charge-limit.conf` (a line `supply=NAME`;
omamobile-device-husky ships it for `max77759-charger`) and only while that
supply has `charge_control_end_threshold`. Everywhere else the Battery row is
hidden (the catalog row's `"requires": "charge"`: Settings runs
`backends/charge.sh get` at start and shows the row only on
`{"available":true}`), and the backend and the helper write nothing. The row
appears only if the charger was there when Settings started: a charger that
shows up later needs Settings to be started again. The page
runs `backends/charge.sh`, which starts `omamobile-charge-limit@N.service`; the
polkit rule `50-omamobile-charge-limit.rules` lets the active local user start
those five instances only. The service runs `libexec/charge-limit` as root,
which checks the declaration, writes the charger (start threshold 0, then the
end threshold) and only then saves the value to `/etc/omamobile/charge-limit`.
The device package that declares the limit also ships the udev rule and
`omamobile-charge-limit-apply.service`, which run the same helper without an
argument when the charger appears, to apply the saved value at boot. The
Pixel 9a's limit (`omamobile-device-tegu`, from `/etc/omamobile/charge-limit`
by its own script) is not declared, so Settings leaves it alone. On husky the
row stays hidden today: omamobile-device-husky blacklists `max77759_charger`
(`omamobile-max77759.conf`), so there is no `max77759-charger` power supply
until that blacklist is lifted on a kernel with
derekross/linux-omarchy-mobile#266.
Omarchy's existing tools continue to provide the other settings changes. Network, wallpaper, app management and
recording controls are separate future contributions with their own runtime
contracts and tests; this catalog does not offer those routes.
Expand Down
44 changes: 44 additions & 0 deletions packages/omamobile-settings/app/BatteryPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: MIT
import QtQuick
import QtQuick.Layouts
import "."
ColumnLayout {
id: page
spacing: 14
property int limit: -1
property bool available: false
property string status: qsTr("Reading the charger...")
property bool busy: true
property int reqId: -1
readonly property var levels: [80, 85, 90, 95, 100]
function apply(r) {
busy = false
if (r.error) { status = r.error; return }
available = r.available === true
if (!available) { status = qsTr("Settings cannot set a charge limit on this phone."); return }
if (r.limit === undefined) { status = qsTr("The charger backend gave no value."); return }
limit = r.limit
status = qsTr("Stops charging at this level; it resumes 5 % lower. 100 % charges fully.")
}
Connections { target: actions; function onFinished(tool, r, id) { if (tool === "charge" && id === page.reqId) page.apply(r) } }
Component.onCompleted: reqId = actions.run("charge", ["get"])
SettingsLabel {
visible: page.available
text: page.limit > 0 ? qsTr("Charge limit: %1 %").arg(page.limit) : qsTr("Charge limit")
font.weight: Font.DemiBold; color: backend.foreground; Layout.fillWidth: true
}
Flow {
visible: page.available
Layout.fillWidth: true; spacing: 8
Repeater {
model: page.levels
delegate: SettingsButton {
required property int modelData
text: modelData + "%"; highlighted: page.limit === modelData; enabled: !page.busy
onClicked: { page.busy = true; page.reqId = actions.run("charge", ["set", "limit", String(modelData)]) }
}
}
}
SettingsLabel { text: page.status; color: backend.muted; font.pixelSize: SettingsStyle.fontPx(13); wrapMode: Text.Wrap; Layout.fillWidth: true }
Item { Layout.fillHeight: true }
}
2 changes: 1 addition & 1 deletion packages/omamobile-settings/app/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ApplicationWindow {
if (backend.searching) search.clear()
backend.back()
}
readonly property var customPages: ({ display: "DisplayPage.qml" })
readonly property var customPages: ({ display: "DisplayPage.qml", battery: "BatteryPage.qml" })
readonly property string customSource: backend.searching ? "" : (customPages[backend.page] || "")
readonly property bool showingAbout: backend.page === "about" && !backend.searching
Connections {
Expand Down
5 changes: 2 additions & 3 deletions packages/omamobile-settings/app/actionrunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ void ActionRunner::post(const QString &tool, const QVariantMap &result, int id)

int ActionRunner::run(const QString &tool, const QStringList &args) {
static const QRegularExpression word("\\A[a-z0-9]{1,16}\\z");
static const QStringList tools = {"display"};
static const QStringList tools = {"display", "charge"};
const int id = ++m_next;
auto fail = [this, &tool, id](const QString &why) { post(tool, {{"error", why}}, id); return id; };
if (!tools.contains(tool) || args.size() > 3) return fail("unknown action");
for (const auto &a : args) if (!word.match(a).hasMatch()) return fail("bad argument");
const QString dir = "/usr/lib/omamobile-settings/backends";
auto *p = new QProcess(this);
// bash would run a startup file named by these
auto env = QProcessEnvironment::systemEnvironment();
env.remove("BASH_ENV");
env.remove("ENV");
p->setProcessEnvironment(env);
p->setProgram("/usr/bin/bash");
p->setArguments(QStringList{dir + "/" + tool + ".sh"} + args);
p->setArguments(QStringList{m_dir + "/" + tool + ".sh"} + args);
connect(p, &QProcess::finished, this, [this, p, tool, id](int code, QProcess::ExitStatus st) {
const auto raw = p->readAllStandardOutput().left(4096);
p->readAllStandardError();
Expand Down
5 changes: 4 additions & 1 deletion packages/omamobile-settings/app/actionrunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
#include <QVariantMap>
#include <QStringList>

// Runs the source-owned backend scripts (display) with a fixed argument list and no shell. Pages call run();
// Runs the source-owned backend scripts (display, charge) with a fixed argument list and no shell. Pages call run();
// the JSON the script prints comes back through finished(), always from the event loop and never before run()
// has returned its id.
class ActionRunner : public QObject {
Q_OBJECT
public:
explicit ActionRunner(QObject *parent = nullptr) : QObject(parent) {}
Q_INVOKABLE int run(const QString &tool, const QStringList &args);
// Where the backend scripts live; tests point it at stubs so they don't depend on the host's install.
void setBackendDir(const QString &dir) { m_dir = dir; }
signals:
void finished(const QString &tool, const QVariantMap &result, int id);
private:
void post(const QString &tool, const QVariantMap &result, int id);
int m_next = 0;
QString m_dir = QStringLiteral("/usr/lib/omamobile-settings/backends");
};
37 changes: 35 additions & 2 deletions packages/omamobile-settings/app/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <QFileInfo>
#include <QJsonArray>
#include <QJsonDocument>
#include <QProcessEnvironment>
#include <QRegularExpression>
#include <QSet>
#include <QTimer>
Expand All @@ -30,8 +31,40 @@ Backend::Backend(QObject *parent) : QObject(parent) {
});
reloadTheme();
rebuild();
QTimer::singleShot(0, this, [this] { probe("charge"); });
}
void Backend::probe(const QString &tool) {
// The same fixed-argument call the page makes (actionrunner.cpp): bash, no startup file, one `get`.
auto *p = &m_chargeProbe;
connect(p, &QProcess::finished, this, [this, p, tool](int code, QProcess::ExitStatus status) {
const auto raw = p->readAllStandardOutput().left(4096);
p->readAllStandardError();
const auto obj = QJsonDocument::fromJson(raw).object();
setToolAvailable(tool, code == 0 && status == QProcess::NormalExit && obj["available"].toBool());
});
auto env = QProcessEnvironment::systemEnvironment();
env.remove("BASH_ENV");
env.remove("ENV");
p->setProcessEnvironment(env);
p->start("/usr/bin/bash", {m_backendDir + "/" + tool + ".sh", "get"});
p->closeWriteChannel();
QTimer::singleShot(5000, p, [p] { if (p->state() != QProcess::NotRunning) p->kill(); });
}
void Backend::setToolAvailable(const QString &tool, bool available) {
if (available == m_availableTools.contains(tool)) return;
if (available) m_availableTools.insert(tool); else m_availableTools.remove(tool);
rebuild();
}
bool Backend::shown(const QJsonObject &row) const {
const auto tool = row["requires"].toString();
return tool.isEmpty() || m_availableTools.contains(tool);
}
Backend::~Backend() {
m_chargeProbe.disconnect(this);
if (m_chargeProbe.state() != QProcess::NotRunning) {
m_chargeProbe.kill();
m_chargeProbe.waitForFinished(1000);
}
m_roundingQuery.disconnect(this);
if (m_roundingQuery.state() != QProcess::NotRunning) {
m_roundingQuery.kill();
Expand Down Expand Up @@ -80,12 +113,12 @@ void Backend::rebuild() {
m_rows.clear();
if (!searching()) {
for (const auto &row : m_catalog[m_page].toObject()["rows"].toArray())
m_rows.append(row.toObject().toVariantMap());
if (shown(row.toObject())) m_rows.append(row.toObject().toVariantMap());
} else {
for (const auto &page : m_catalog) {
for (const auto &value : page.toObject()["rows"].toArray()) {
const auto row = value.toObject();
if ((row["title"].toString() + " " + row["detail"].toString()).contains(m_query, Qt::CaseInsensitive))
if (shown(row) && (row["title"].toString() + " " + row["detail"].toString()).contains(m_query, Qt::CaseInsensitive))
m_rows.append(row.toVariantMap());
}
}
Expand Down
12 changes: 12 additions & 0 deletions packages/omamobile-settings/app/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QVariantList>
#include <QFileSystemWatcher>
#include <QProcess>
#include <QSet>
#include "themetokens.h"

class Backend : public QObject {
Expand Down Expand Up @@ -46,6 +47,12 @@ class Backend : public QObject {
void setHomeCommand(const QStringList &command) { m_homeCommand = command; }
Q_INVOKABLE QString icon(const QString &name) const;
Q_INVOKABLE QStringList catalogProblems() const;
// A row with "requires": TOOL is shown only once that backend's `get` has said {"available":true} (the Battery
// row: only on a phone whose device package declares a charge limit). The probe calls this; so do the tests.
void setToolAvailable(const QString &tool, bool available);
// Where the probe finds the backend scripts; tests point it at stubs so they don't depend on the host's
// install. The probe starts from the event loop, so set this right after construction.
void setBackendDir(const QString &dir) { m_backendDir = dir; }
Q_SCRIPTABLE bool Open(const QString &page);
signals:
void rowsChanged();
Expand All @@ -55,6 +62,8 @@ class Backend : public QObject {
void raiseRequested();
private:
void rebuild();
bool shown(const QJsonObject &row) const;
void probe(const QString &tool);
void reloadTheme();
QJsonObject m_catalog;
QVariantList m_rows;
Expand All @@ -63,6 +72,9 @@ class Backend : public QObject {
QStringList m_homeCommand{"omamobile-home"};
QFileSystemWatcher m_watcher;
QProcess m_roundingQuery;
QProcess m_chargeProbe;
QSet<QString> m_availableTools;
QString m_backendDir = QStringLiteral("/usr/lib/omamobile-settings/backends");
quint64 m_roundingGeneration = 0;
int m_radius = 0;
QVariantMap m_themeTokens = SettingsTheme::tokens({}, {});
Expand Down
12 changes: 12 additions & 0 deletions packages/omamobile-settings/app/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"icon": "display",
"page": "display"
},
{
"id": "battery",
"title": "Battery",
"detail": "Charge limit",
"icon": "battery",
"page": "battery",
"requires": "charge"
},
{
"id": "about",
"title": "About this device",
Expand All @@ -25,5 +33,9 @@
"display": {
"title": "Display",
"rows": []
},
"battery": {
"title": "Battery",
"rows": []
}
}
1 change: 1 addition & 0 deletions packages/omamobile-settings/app/icons/battery.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading