~kennylevinsen/poweralertd-devel

feat: don't send warning when changing from unknown to no warning v1 APPLIED

Thomas Weißschuh: 1
 feat: don't send warning when changing from unknown to no warning

 1 files changed, 4 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/poweralertd-devel/patches/27173/mbox | git am -3
Learn more about email & git

[PATCH] feat: don't send warning when changing from unknown to no warning Export this patch

When a device is added via BlueZ it is first added at warning_level
"unknown" and then changes to "none".
This triggers a spurious notification about "Warning cleared" although
no warning was ever reported.
---
 main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/main.c b/main.c
index 30ca4b5..20b1f25 100644
--- a/main.c
+++ b/main.c
@@ -91,6 +91,10 @@ static int send_warning_update(sd_bus *bus, struct upower_device *device) {
		return 0;
	}

	if (device->current.warning_level == UPOWER_DEVICE_LEVEL_NONE && device->last.warning_level == UPOWER_DEVICE_LEVEL_UNKNOWN) {
		return 0;
	}

	enum urgency urgency = URGENCY_CRITICAL;
	char title[NOTIFICATION_MAX_LEN];
	char *msg;

base-commit: 3c0c7c727db9c7fc03e790946541e2b2d0146cd2
-- 
2.34.1
Applied, thanks!