]> git.madduck.net Git - etc/awesome.git/commitdiff

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:

Merge pull request #418 from cool-cool-sweat/full_notify
authorLuca CPZ <1777696+lcpz@users.noreply.github.com>
Mon, 14 Jan 2019 10:59:13 +0000 (10:59 +0000)
committerGitHub <noreply@github.com>
Mon, 14 Jan 2019 10:59:13 +0000 (10:59 +0000)
bat: allow disabling notification for full charge

widget/bat.lua

index 5a301b50a266c1680e4d2540ef43d6da2b1525d6..3cb801c8ef93eeda994dedcfe960171979e513dc 100644 (file)
@@ -26,14 +26,15 @@ local function factory(args)
         return
     end
 
-    local bat       = { widget = wibox.widget.textbox() }
-    local args      = args or {}
-    local timeout   = args.timeout or 30
-    local notify    = args.notify or "on"
-    local n_perc    = args.n_perc or { 5, 15 }
-    local batteries = args.batteries or (args.battery and {args.battery}) or {}
-    local ac        = args.ac or "AC0"
-    local settings  = args.settings or function() end
+    local bat         = { widget = wibox.widget.textbox() }
+    local args        = args or {}
+    local timeout     = args.timeout or 30
+    local notify      = args.notify or "on"
+    local full_notify = args.full_notify or notify
+    local n_perc      = args.n_perc or { 5, 15 }
+    local batteries   = args.batteries or (args.battery and {args.battery}) or {}
+    local ac          = args.ac or "AC0"
+    local settings    = args.settings or function() end
 
     function bat.get_batteries()
         helpers.line_callback("ls -1 " .. pspath, function(line)
@@ -198,7 +199,7 @@ local function factory(args)
                     }).id
                 end
                 fullnotification = false
-            elseif bat_now.status == "Full" and not fullnotification then
+            elseif bat_now.status == "Full" and full_notify == "on" and not fullnotification then
                 bat.id = naughty.notify({
                     preset = bat_notification_charged_preset,
                     replaces_id = bat.id