madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

widget.fs: fix notification check, add threshold parameter for trigger
authorLuca CPZ <luca.cpz@gmail.com>
Sun, 30 Dec 2018 18:12:17 +0000 (19:12 +0100)
committerLuca CPZ <luca.cpz@gmail.com>
Sun, 30 Dec 2018 18:12:25 +0000 (19:12 +0100)
widget/cal.lua
widget/fs.lua
wiki

index 47e91a979889739046d314d4251da11a2f056458..9b613bf6cf08b361a0b3cad062fa7208a6d51697 100644 (file)
@@ -19,6 +19,7 @@ local tostring = tostring
 
 -- Calendar notification
 -- lain.widget.cal
+
 local function factory(args)
     args = args or {}
     local cal = {
index 358d4dd71ded95f8f1102641f530e515efecb70a..d1b7a971a3d1e7ac0540cb3ef1abc5fdd5a5d631 100644 (file)
@@ -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 11ea6b6bc6661396e6d29f362f94c5561a94eb44..7a994596603c2129ae18dd2de69f765e2838c2cd 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit 11ea6b6bc6661396e6d29f362f94c5561a94eb44
+Subproject commit 7a994596603c2129ae18dd2de69f765e2838c2cd