mirror of https://github.com/lcpz/lain.git
widget.fs: fix notification check, add threshold parameter for trigger
This commit is contained in:
parent
1342ae481b
commit
1a40fe80f8
|
@ -19,6 +19,7 @@ local tostring = tostring
|
|||
|
||||
-- Calendar notification
|
||||
-- lain.widget.cal
|
||||
|
||||
local function factory(args)
|
||||
args = args or {}
|
||||
local cal = {
|
||||
|
|
|
@ -52,6 +52,7 @@ local function factory(args)
|
|||
local args = args or {}
|
||||
local timeout = args.timeout or 600
|
||||
local partition = args.partition
|
||||
local threshold = args.threshold or 99
|
||||
local showpopup = args.showpopup or "on"
|
||||
local settings = args.settings or function() end
|
||||
|
||||
|
@ -106,12 +107,12 @@ local function factory(args)
|
|||
widget = fs.widget
|
||||
settings()
|
||||
|
||||
if partition and fs_now[partition] and fs_now[partition].used >= 99 then
|
||||
if partition and fs_now[partition] and fs_now[partition].percentage >= threshold then
|
||||
if not helpers.get_map(partition) then
|
||||
naughty.notify {
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "Warning",
|
||||
text = partition .. " is full",
|
||||
text = string.format("%s is above %d%% (%d%%)", partition, threshold, fs_now[partition].percentage)
|
||||
}
|
||||
helpers.set_map(partition, true)
|
||||
else
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit 11ea6b6bc6661396e6d29f362f94c5561a94eb44
|
||||
Subproject commit 7a994596603c2129ae18dd2de69f765e2838c2cd
|
Loading…
Reference in New Issue