Update Battery widget plugin (#311)

* fix: invalid check in getWarningThreshold

* fix: invalid status

* feat: use dbus events instead of polling

* fix: invalid status again

* fix: dump version and set valid plugin API

* fix: add commandExists check

* fix: getColor function (warning color when not charging)

* feat: use upower instead of cat /sys

* feat: notify on error

* fix: cleaner code

* fix: use noctalia.tr for notification (not logs, intended)

* feat: migrate from dbus-monitor to gdbus (everything in one line)

* feat: use gdbus to init and update, parse only when needed

* feat: add label_content and optimisations

* fix: remove multiple commands check not needed anymore

* fix: update README and dump version

* fix: default data, warning_threshold check, floor percent
This commit is contained in:
Yocraft-2000
2026-08-12 09:37:30 -04:00
committed by GitHub
parent 97389b0ff8
commit e9121c114c
4 changed files with 197 additions and 57 deletions
+15 -12
View File
@@ -1,14 +1,14 @@
id = "yocraft/battery-widget"
name = "Battery Widget"
version = "1.0.1"
plugin_api = 19
version = "2.0.0"
plugin_api = 3
author = "yocraft"
license = "MIT"
deprecated = false
icon = "battery"
description = "Desktop/Lockscreen widget to show battery."
tags = [ "desktop", "hardware", "system", "utility" ]
dependencies = []
dependencies = [ "upower", "gdbus" ]
[[desktop_widget]]
id = "widget"
@@ -39,6 +39,18 @@ entry = "widget.luau"
description_key = "settings.show_label.description"
default = true
[[desktop_widget.setting]]
key = "label_content"
type = "select"
label_key = "settings.label_content.label"
description_key = "settings.label_content.description"
default = "percent"
options = [
{ value = "percent", label_key = "settings.label_content.percent" },
{ value = "time", label_key = "settings.label_content.time" },
{ value = "rate", label_key = "settings.label_content.rate" },
]
[[desktop_widget.setting]]
key = "hide_plugged"
type = "bool"
@@ -98,12 +110,3 @@ entry = "widget.luau"
description_key = "settings.battery_name.description"
default = "BAT0"
visible_when = { key = "battery", values = ["custom"] }
[[desktop_widget.setting]]
key = "refresh_interval"
type = "int"
label_key = "settings.refresh_interval.label"
description_key = "settings.refresh_interval.description"
default = 60
min = 1
max = 600