From 1a40fe80f801a27e047ce29f57215eca8f84bf6f Mon Sep 17 00:00:00 2001 From: Luca CPZ Date: Sun, 30 Dec 2018 19:12:17 +0100 Subject: [PATCH] widget.fs: fix notification check, add threshold parameter for trigger --- widget/cal.lua | 1 + widget/fs.lua | 5 +++-- wiki | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/widget/cal.lua b/widget/cal.lua index 47e91a9..9b613bf 100644 --- a/widget/cal.lua +++ b/widget/cal.lua @@ -19,6 +19,7 @@ local tostring = tostring -- Calendar notification -- lain.widget.cal + local function factory(args) args = args or {} local cal = { diff --git a/widget/fs.lua b/widget/fs.lua index 358d4dd..d1b7a97 100644 --- a/widget/fs.lua +++ b/widget/fs.lua @@ -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 diff --git a/wiki b/wiki index 11ea6b6..7a99459 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 11ea6b6bc6661396e6d29f362f94c5561a94eb44 +Subproject commit 7a994596603c2129ae18dd2de69f765e2838c2cd