mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-24 23:47:14 -08:00
kde-plasma/powerdevil: Avoid low battery alerts for unknown percentages
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=525589 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
From 54f8a4a848fa02d06fefc5543f35224eef73670c Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Kurz <m.kurz@irregular.at>
|
||||
Date: Wed, 19 Aug 2026 17:51:12 +0200
|
||||
Subject: [PATCH] Avoid low battery alerts for unknown percentages
|
||||
|
||||
Peripheral batteries with an unavailable charge return a negative percentage. Exclude all non-positive values from low-battery notification handling so an unknown device cannot be mistaken for an empty one.
|
||||
|
||||
(cherry picked from commit 78e99fd944a0da0d82b46d02251a8631f005f5ba)
|
||||
---
|
||||
daemon/powerdevilcore.cpp | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/daemon/powerdevilcore.cpp b/daemon/powerdevilcore.cpp
|
||||
index 50d936c20..fabcc671d 100644
|
||||
--- a/daemon/powerdevilcore.cpp
|
||||
+++ b/daemon/powerdevilcore.cpp
|
||||
@@ -521,9 +521,9 @@ bool Core::emitBatteryChargePercentNotification(int currentPercent, int previous
|
||||
return false;
|
||||
}
|
||||
|
||||
- // if you leave the device out of reach or it has not been initialized yet
|
||||
- // it won't be "there" and report 0%, don't show anything in this case
|
||||
- if (!b->isPresent() || b->chargePercent() == 0) {
|
||||
+ // If you leave the device out of reach or it has not been initialized yet,
|
||||
+ // it won't be "there" and can report an empty or unknown percentage.
|
||||
+ if (!b->isPresent() || b->chargePercent() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
ECM_HANDBOOK="optional"
|
||||
ECM_TEST="forceoptional"
|
||||
KFMIN=6.26.0
|
||||
QTMIN=6.11.2
|
||||
inherit ecm fcaps plasma.kde.org xdg
|
||||
|
||||
DESCRIPTION="Power management for KDE Plasma Shell"
|
||||
HOMEPAGE="https://invent.kde.org/plasma/powerdevil"
|
||||
|
||||
LICENSE="GPL-2" # TODO: CHECK
|
||||
SLOT="6"
|
||||
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
|
||||
IUSE="brightness-control"
|
||||
|
||||
RESTRICT="test" # bug 926513
|
||||
|
||||
# slot op: Uses Qt::GuiPrivate for qtx11extras_p.h
|
||||
COMMON_DEPEND="
|
||||
dev-libs/qcoro[dbus]
|
||||
dev-libs/wayland
|
||||
>=dev-qt/qtbase-${QTMIN}:6=[dbus,gui,wayland,widgets,X]
|
||||
>=kde-frameworks/kauth-${KFMIN}:6[policykit]
|
||||
>=kde-frameworks/kcmutils-${KFMIN}:6
|
||||
>=kde-frameworks/kconfig-${KFMIN}:6
|
||||
>=kde-frameworks/kconfigwidgets-${KFMIN}:6
|
||||
>=kde-frameworks/kcoreaddons-${KFMIN}:6
|
||||
>=kde-frameworks/kcrash-${KFMIN}:6
|
||||
>=kde-frameworks/kdbusaddons-${KFMIN}:6
|
||||
>=kde-frameworks/kglobalaccel-${KFMIN}:6
|
||||
>=kde-frameworks/ki18n-${KFMIN}:6
|
||||
>=kde-frameworks/kidletime-${KFMIN}:6
|
||||
>=kde-frameworks/kio-${KFMIN}:6
|
||||
>=kde-frameworks/kirigami-${KFMIN}:6
|
||||
>=kde-frameworks/kitemmodels-${KFMIN}:6
|
||||
>=kde-frameworks/knotifications-${KFMIN}:6
|
||||
>=kde-frameworks/krunner-${KFMIN}:6
|
||||
>=kde-frameworks/kservice-${KFMIN}:6
|
||||
>=kde-frameworks/kxmlgui-${KFMIN}:6
|
||||
>=kde-frameworks/solid-${KFMIN}:6
|
||||
>=kde-plasma/libkscreen-${KDE_CATV}:6
|
||||
>=kde-plasma/libplasma-${KDE_CATV}:6=
|
||||
>=kde-plasma/plasma-activities-${KDE_CATV}:6=
|
||||
>=kde-plasma/plasma-workspace-${KDE_CATV}:6
|
||||
virtual/libudev:=
|
||||
x11-libs/libxcb
|
||||
brightness-control? ( app-misc/ddcutil:= )
|
||||
"
|
||||
DEPEND="${COMMON_DEPEND}
|
||||
>=dev-libs/plasma-wayland-protocols-1.20.0
|
||||
"
|
||||
RDEPEND="${COMMON_DEPEND}
|
||||
!<kde-plasma/plasma-workspace-6.1.90:*
|
||||
>=dev-qt/qtdeclarative-${QTMIN}:6
|
||||
>=kde-frameworks/kwindowsystem-${KFMIN}:6
|
||||
|| (
|
||||
sys-apps/tuned[ppd]
|
||||
sys-power/power-profiles-daemon
|
||||
sys-power/tlp
|
||||
)
|
||||
>=sys-power/upower-0.9.23
|
||||
"
|
||||
BDEPEND="
|
||||
>=dev-qt/qtbase-${QTMIN}:6[wayland]
|
||||
dev-util/wayland-scanner
|
||||
>=kde-frameworks/kcmutils-${KFMIN}:6
|
||||
"
|
||||
|
||||
# -m 0755 to avoid suid with USE="-filecaps"
|
||||
FILECAPS=( -m 0755 cap_wake_alarm=ep usr/libexec/org_kde_powerdevil )
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${P}-solid-6.30-negative-percentage.patch" # KDE-bug #525589
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
local mycmakeargs=(
|
||||
$(cmake_use_find_package brightness-control DDCUtil)
|
||||
)
|
||||
use test && mycmakeargs+=(
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_SeleniumWebDriverATSPI=ON # not packaged
|
||||
)
|
||||
|
||||
ecm_src_configure
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# bug 926513
|
||||
ecm_src_test -j1
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
if has_version "<sys-apps/systemd-257"; then
|
||||
ewarn "org_kde_powerdevil won't start under systemd user session."
|
||||
ewarn "You must upgrade to >=sys-apps/systemd-257. Bug #956312"
|
||||
fi
|
||||
xdg_pkg_postinst
|
||||
fcaps_pkg_postinst
|
||||
}
|
||||
Reference in New Issue
Block a user