Don't warn for both critical and custom

This commit is contained in:
Stefano Mazzucco 2019-12-16 21:26:16 +00:00
parent c7f3a2a24d
commit d149972d2e
1 changed files with 11 additions and 7 deletions

View File

@ -146,18 +146,22 @@ local function update(widget)
update_icon(widget)
update_tooltip(widget)
maybe_warn(
widget,
should_warn_critical(widget),
naughty.config.presets.critical
)
local critical_warn = should_warn_critical(widget)
maybe_warn(
widget,
get_percentage() <= widget.warning_config.percentage,
widget.warning_config.preset
critical_warn,
naughty.config.presets.critical
)
if not critical_warn then
maybe_warn(
widget,
get_percentage() <= widget.warning_config.percentage,
widget.warning_config.preset
)
end
if device.state ~= power.enums.BatteryState.Discharging and notification then
naughty.destroy(
notification,