Update Battery widget plugin (#346)
* fix: don't notify on warnings, use same default warning_threshold as noctalia * chore: dump version
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
id = "yocraft/battery-widget"
|
id = "yocraft/battery-widget"
|
||||||
name = "Battery Widget"
|
name = "Battery Widget"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
plugin_api = 3
|
plugin_api = 3
|
||||||
author = "yocraft"
|
author = "yocraft"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local color
|
|||||||
local data = { percent = 0, status = "unknown" }
|
local data = { percent = 0, status = "unknown" }
|
||||||
|
|
||||||
local label_content = noctalia.getConfig("label_content")
|
local label_content = noctalia.getConfig("label_content")
|
||||||
local warning_threshold = 20
|
local warning_threshold = 10
|
||||||
|
|
||||||
local path = "/sys/class/power_supply/"
|
local path = "/sys/class/power_supply/"
|
||||||
local batName
|
local batName
|
||||||
@@ -108,7 +108,6 @@ local function getWarningThreshold()
|
|||||||
function(result)
|
function(result)
|
||||||
if result.exitCode ~= 0 then
|
if result.exitCode ~= 0 then
|
||||||
noctalia.log("battery-widget: failed to get warning_threshold: " .. result.stderr)
|
noctalia.log("battery-widget: failed to get warning_threshold: " .. result.stderr)
|
||||||
notifyError()
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -116,7 +115,6 @@ local function getWarningThreshold()
|
|||||||
|
|
||||||
if not res then
|
if not res then
|
||||||
noctalia.log("battery-widget: invalid warning_threshold, keeping default")
|
noctalia.log("battery-widget: invalid warning_threshold, keeping default")
|
||||||
notifyError()
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -125,7 +123,6 @@ local function getWarningThreshold()
|
|||||||
warning_threshold = parsed
|
warning_threshold = parsed
|
||||||
else
|
else
|
||||||
noctalia.log("battery-widget: invalid warning_threshold, keeping default")
|
noctalia.log("battery-widget: invalid warning_threshold, keeping default")
|
||||||
notifyError()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -227,11 +224,13 @@ local function initData()
|
|||||||
function(result)
|
function(result)
|
||||||
if result.exitCode ~= 0 then
|
if result.exitCode ~= 0 then
|
||||||
noctalia.log("battery-widget: failed to read battery: " .. result.stderr)
|
noctalia.log("battery-widget: failed to read battery: " .. result.stderr)
|
||||||
|
notifyError()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not result.stdout then
|
if not result.stdout then
|
||||||
noctalia.log("battery-widget: invalid battery output")
|
noctalia.log("battery-widget: invalid battery output")
|
||||||
|
notifyError()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user