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
11 changes: 10 additions & 1 deletion packages/dbus/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Freedesktop.org message bus system"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="1.16.2"
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL="https://dbus.freedesktop.org/releases/dbus/dbus-$TERMUX_PKG_VERSION.tar.xz"
TERMUX_PKG_SHA256=0ba2a1a4b16afe7bceb2c07e9ce99a8c2c3508e5dec290dbb643384bd6beb7e2
TERMUX_PKG_DEPENDS="libexpat, libx11"
Expand All @@ -23,6 +23,15 @@ termux_step_pre_configure() {
export LIBS="-llog"
# Enforce meson building
rm CMakeLists.txt

if [[ "$TERMUX_DEBUG_BUILD" == "true" ]]; then
# How to get extra-verbose logging:
# 1. build with -Dverbose_mode=true
# 2. use export DBUS_VERBOSE=1
# 3. launch DBus with --nofork, for example:
# DBUS_VERBOSE=1 dbus-daemon --system --nofork
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -Dverbose_mode=true"
fi
}

termux_step_post_make_install() {
Expand Down
9 changes: 9 additions & 0 deletions packages/dbus/bus-activation-helper.c.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
--- a/bus/activation-helper.c
+++ b/bus/activation-helper.c
@@ -171,7 +171,7 @@ clear_environment (DBusError *error)
static dbus_bool_t
check_permissions (const char *dbus_user, DBusError *error)
{
-#ifndef ACTIVATION_LAUNCHER_TEST
+#if !defined ACTIVATION_LAUNCHER_TEST && !defined __ANDROID__
uid_t uid, euid;
struct passwd *pw;

@@ -294,7 +294,8 @@
static dbus_bool_t
switch_user (char *user, DBusError *error)
Expand Down
11 changes: 11 additions & 0 deletions packages/dbus/bus-policy.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -1390,7 +1390,7 @@ bus_rules_check_can_own (DBusList *rules,
allowed = rule->allow;
}

- return allowed;
+ return TRUE;
}

dbus_bool_t
3 changes: 2 additions & 1 deletion packages/upower/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ TERMUX_PKG_DESCRIPTION="Power management support for DeviceKit"
TERMUX_PKG_LICENSE="GPL-2.0-or-later"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="1.91.1"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL="https://gitlab.freedesktop.org/upower/upower/-/archive/v$TERMUX_PKG_VERSION/upower-v$TERMUX_PKG_VERSION.tar.gz"
TERMUX_PKG_SHA256=cd87801c8489778b76bbdcd4e03ae60b44ef5bcc2fed40332630fbadb4343517
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="glib, gobject-introspection"
TERMUX_PKG_DEPENDS="glib, gobject-introspection, termux-api"
TERMUX_PKG_BUILD_DEPENDS="g-ir-scanner, glib-cross"
TERMUX_PKG_VERSIONED_GIR=false

Expand Down
10 changes: 10 additions & 0 deletions packages/upower/fix-dbus-service-dir-to-session.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/src/meson.build 2026-02-18 21:27:31.569917142 +0530
+++ b/src/meson.build 2026-02-19 15:38:24.999761284 +0530
@@ -95,7 +95,7 @@
configure_file(
input: 'org.freedesktop.UPower.service.in',
output: 'org.freedesktop.UPower.service',
- install_dir: dbusdir / 'system-services',
+ install_dir: dbusdir / 'services',
configuration: cdata,
)
157 changes: 157 additions & 0 deletions packages/upower/fix-dummy-backend.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
diff --git a/src/dummy/up-backend.c b/src/dummy/up-backend.c
index 419da7c..d083796 100644
--- a/src/dummy/up-backend.c
+++ b/src/dummy/up-backend.c
@@ -34,15 +34,18 @@
static void up_backend_class_init (UpBackendClass *klass);
static void up_backend_init (UpBackend *backend);
static void up_backend_finalize (GObject *object);
+#ifdef __TERMUX__
+static gboolean termux_update_device (gpointer user_data);
+#endif

struct UpBackendPrivate
{
UpDaemon *daemon;
-#ifdef EGG_TEST
+#if defined(EGG_TEST) || defined(__TERMUX__)
UpDevice *device;
#endif
UpDeviceList *device_list; /* unused */
-#ifdef EGG_TEST
+#if defined(EGG_TEST) || defined(__TERMUX__)
GObject *native;
#endif
};
@@ -117,7 +120,30 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
backend->priv->daemon = g_object_ref (daemon);
backend->priv->device_list = up_daemon_get_device_list (daemon);

-#ifdef EGG_TEST
+#if defined(__TERMUX__)
+
+ backend->priv->native = g_object_new (G_TYPE_OBJECT, NULL);
+ backend->priv->device = up_device_new (daemon, backend->priv->native);
+
+ g_object_set (backend->priv->device,
+ "native-path", "/org/termux/BAT0",
+ "vendor", "Android",
+ "model", "Battery",
+ "type", UP_DEVICE_KIND_BATTERY,
+ "power-supply", TRUE,
+ "is-present", TRUE,
+ "is-rechargeable", TRUE,
+ "has-history", FALSE,
+ "has-statistics", FALSE,
+ NULL);
+
+ g_initable_init (G_INITABLE (backend->priv->device), NULL, NULL);
+ g_signal_emit (backend, signals[SIGNAL_DEVICE_ADDED], 0, backend->priv->device);
+
+ termux_update_device (backend->priv->device);
+ g_timeout_add_seconds (5, termux_update_device, backend->priv->device);
+
+#elif defined(EGG_TEST)
/* small delay until first device is added */
g_timeout_add_seconds (1, (GSourceFunc) up_backend_add_cb, backend);
#endif
@@ -214,6 +240,88 @@ up_backend_class_init (UpBackendClass *klass)
/**
* up_backend_init:
**/
+#ifdef __TERMUX__
+
+static gboolean
+termux_update_device (gpointer user_data)
+{
+ UpDevice *device = UP_DEVICE (user_data);
+ FILE *fp;
+ char buffer[4096];
+ float percentage = 0.0f;
+ char status[64] = {0};
+ char plugged[64] = {0};
+ float temperature = 0.0f;
+ UpDeviceState state = UP_DEVICE_STATE_UNKNOWN;
+ gboolean online = FALSE;
+
+ fp = popen ("@TERMUX_PREFIX@/bin/termux-battery-status", "r");
+ if (!fp)
+ return TRUE;
+
+ size_t len = fread (buffer, 1, sizeof(buffer)-1, fp);
+ buffer[len] = '\0';
+ pclose (fp);
+
+ char *p;
+
+ p = strstr (buffer, "\"percentage\"");
+ if (p)
+ sscanf (p, "\"percentage\": %f", &percentage);
+
+ p = strstr (buffer, "\"status\"");
+ if (p)
+ sscanf (p, "\"status\": \"%63[^\"]\"", status);
+
+ p = strstr (buffer, "\"plugged\"");
+ if (p)
+ sscanf (p, "\"plugged\": \"%63[^\"]\"", plugged);
+
+ p = strstr (buffer, "\"temperature\"");
+ if (p)
+ sscanf (p, "\"temperature\": %f", &temperature);
+
+ if (g_strcmp0 (status, "CHARGING") == 0)
+ state = UP_DEVICE_STATE_CHARGING;
+ else if (g_strcmp0 (status, "DISCHARGING") == 0)
+ state = UP_DEVICE_STATE_DISCHARGING;
+ else if (g_strcmp0 (status, "NOT_CHARGING") == 0)
+ state = UP_DEVICE_STATE_DISCHARGING;
+ else if (g_strcmp0 (status, "FULL") == 0)
+ state = UP_DEVICE_STATE_FULLY_CHARGED;
+ else if (g_strcmp0 (status, "UNKNOWN") == 0)
+ state = UP_DEVICE_STATE_UNKNOWN;
+
+ if (g_strcmp0 (plugged, "PLUGGED_AC") == 0 ||
+ g_strcmp0 (plugged, "PLUGGED_USB") == 0 ||
+ g_strcmp0 (plugged, "PLUGGED_WIRELESS") == 0 ||
+ g_strcmp0 (plugged, "PLUGGED_DOCK") == 0)
+ online = TRUE;
+ else
+ online = FALSE;
+
+ double energy = percentage;
+ double energy_full = 100.0;
+ double energy_empty = 0.0;
+
+ g_object_set (device,
+ "percentage", percentage,
+ "state", state,
+ "online", online,
+ "temperature", temperature,
+ "energy", energy,
+ "energy-empty", energy_empty,
+ "energy-full", energy_full,
+ "energy-full-design", energy_full,
+ "energy-rate", 0.0,
+ "update-time", (guint64) g_get_real_time () / G_USEC_PER_SEC,
+ NULL);
+
+ return TRUE;
+}
+
+#endif
+
static void
up_backend_init (UpBackend *backend)
{
diff --git a/src/dummy/up-native.c b/src/dummy/up-native.c
index 82de1a9..545925b 100644
--- a/src/dummy/up-native.c
+++ b/src/dummy/up-native.c
@@ -35,5 +35,5 @@
const gchar *
up_native_get_native_path (GObject *object)
{
- return "/sys/dummy";
+ return "/org/termux/BAT0";
}
33 changes: 33 additions & 0 deletions packages/upower/use-sessionbus.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--- a/libupower-glib/up-client.c
+++ b/libupower-glib/up-client.c
@@ -541,7 +541,7 @@
client->priv = up_client_get_instance_private (client);

/* connect to main interface */
- client->priv->proxy = up_exported_daemon_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ client->priv->proxy = up_exported_daemon_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.UPower",
"/org/freedesktop/UPower",
--- a/libupower-glib/up-device.c
+++ b/libupower-glib/up-device.c
@@ -157,7 +157,7 @@
g_clear_pointer (&device->priv->offline_props, g_hash_table_unref);

/* connect to the correct path for all the other methods */
- proxy_device = up_exported_device_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ proxy_device = up_exported_device_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.UPower",
object_path,
--- a/src/up-main.c
+++ b/src/up-main.c
@@ -269,7 +269,7 @@
bus_flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
if (replace)
bus_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
- g_bus_own_name (G_BUS_TYPE_SYSTEM,
+ g_bus_own_name (G_BUS_TYPE_SESSION,
DEVKIT_POWER_SERVICE_NAME,
bus_flags,
up_main_bus_acquired,
9 changes: 7 additions & 2 deletions x11-packages/kf6-solid/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ TERMUX_PKG_DESCRIPTION='Hardware integration and detection'
TERMUX_PKG_LICENSE="LGPL-2.0, LGPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="6.23.0"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL="https://download.kde.org/stable/frameworks/${TERMUX_PKG_VERSION%.*}/solid-${TERMUX_PKG_VERSION}.tar.xz"
TERMUX_PKG_SHA256=448502ea32c8e049ebd3caf34c5c768fce7f879f25f8b5e700fd3300d317a0cc
TERMUX_PKG_DEPENDS="libimobiledevice, libplist, qt6-qtbase, libc++, util-linux"
# media-player-info, systemd-libs, udisks2, upower can be added to TERMUX_PKG_DEPENDS when available
TERMUX_PKG_DEPENDS="libimobiledevice, libplist, qt6-qtbase, libc++, upower, util-linux"
# media-player-info, systemd-libs, udisks2 can be added to TERMUX_PKG_DEPENDS when available
TERMUX_PKG_BUILD_DEPENDS="extra-cmake-modules (>= ${TERMUX_PKG_VERSION%.*}), qt6-qtdeclarative, qt6-qttools"
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DCMAKE_SYSTEM_NAME=Linux
-DBUILD_DEVICE_BACKEND_upower=ON
-DUSE_DBUS=ON
-DUDEV_DISABLED=ON
-DKDE_INSTALL_QMLDIR=lib/qt6/qml
-DKDE_INSTALL_QTPLUGINDIR=lib/qt6/plugins
"
63 changes: 63 additions & 0 deletions x11-packages/kf6-solid/use-sessionbus.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
--- a/src/solid/devices/backends/upower/upowerdevice.cpp
+++ b/src/solid/devices/backends/upower/upowerdevice.cpp
@@ -24,7 +24,7 @@
: Solid::Ifaces::Device()
, m_udi(udi)
{
- QDBusConnection::systemBus().connect(QStringLiteral(UP_DBUS_SERVICE),
+ QDBusConnection::sessionBus().connect(QStringLiteral(UP_DBUS_SERVICE),
m_udi,
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"),
@@ -33,7 +33,7 @@

// TODO port this to Solid::Power, we can't link against kdelibs4support for this signal
// older upower versions not affected
- QDBusConnection::systemBus().connect(QStringLiteral("org.freedesktop.login1"), //
+ QDBusConnection::sessionBus().connect(QStringLiteral("org.freedesktop.login1"), //
QStringLiteral("/org/freedesktop/login1"),
QStringLiteral("org.freedesktop.login1.Manager"),
QStringLiteral("PrepareForSleep"),
@@ -201,7 +201,7 @@
QDBusMessage call =
QDBusMessage::createMethodCall(QStringLiteral(UP_DBUS_SERVICE), m_udi, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("Get"));
call.setArguments({QStringLiteral(UP_DBUS_INTERFACE_DEVICE), key});
- QDBusReply<QVariant> reply = QDBusConnection::systemBus().call(call);
+ QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(call);

if (reply.isValid()) {
m_cache[key] = reply.value();
@@ -227,7 +227,7 @@
QDBusMessage call =
QDBusMessage::createMethodCall(QStringLiteral(UP_DBUS_SERVICE), m_udi, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("GetAll"));
call.setArguments({QStringLiteral(UP_DBUS_INTERFACE_DEVICE)});
- QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(call);
+ QDBusReply<QVariantMap> reply = QDBusConnection::sessionBus().call(call);

if (reply.isValid()) {
m_cache = reply.value();

--- a/src/solid/devices/backends/upower/upowermanager.cpp
+++ b/src/solid/devices/backends/upower/upowermanager.cpp
@@ -22,7 +22,7 @@
UPowerManager::UPowerManager(QObject *parent)
: Solid::Ifaces::DeviceManager(parent)
, m_supportedInterfaces({Solid::DeviceInterface::GenericInterface, Solid::DeviceInterface::Battery})
- , m_manager(QDBusConnection::systemBus())
+ , m_manager(QDBusConnection::sessionBus())
, m_knownDevices(udiPrefix())
{
qDBusRegisterMetaType<QList<QDBusObjectPath>>();
@@ -36,9 +36,9 @@
QStringLiteral("org.freedesktop.DBus"),
QStringLiteral("ListActivatableNames"));

- QDBusReply<QStringList> reply = QDBusConnection::systemBus().call(message);
+ QDBusReply<QStringList> reply = QDBusConnection::sessionBus().call(message);
if (reply.isValid() && reply.value().contains(QStringLiteral(UP_DBUS_SERVICE))) {
- QDBusConnection::systemBus().interface()->startService(QStringLiteral(UP_DBUS_SERVICE));
+ QDBusConnection::sessionBus().interface()->startService(QStringLiteral(UP_DBUS_SERVICE));
serviceFound = true;
}
}

16 changes: 16 additions & 0 deletions x11-packages/lxqt-powermanagement/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TERMUX_PKG_HOMEPAGE=https://lxqt.github.io
TERMUX_PKG_DESCRIPTION="LXQt power management daemon"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.3.0"
TERMUX_PKG_SRCURL="https://github.com/lxqt/lxqt-powermanagement/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz"
TERMUX_PKG_SHA256="a816d8bca81677487d9b9cc5d8ff85cc2c646accba26a83d0a48ad559dad4a2e"
TERMUX_PKG_DEPENDS="hicolor-icon-theme, kf6-kidletime, kf6-solid, libc++, lxqt-globalkeys, qt6-qtsvg, upower"
TERMUX_PKG_BUILD_DEPENDS="lxqt-build-tools"
TERMUX_PKG_AUTO_UPDATE=true

termux_step_pre_configure() {
if [[ "$TERMUX_ON_DEVICE_BUILD" == "false" ]]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DQt6LinguistTools_DIR=${TERMUX_PREFIX}/opt/qt6/cross/lib/cmake/Qt6LinguistTools"
fi
}
Loading