]> 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:

#424: assert that timeout seconds in every naughty notification are numbers
authorLuca Capezzuto <luca.capezzuto@soton.ac.uk>
Mon, 8 Apr 2019 10:37:38 +0000 (11:37 +0100)
committerLuca Capezzuto <luca.capezzuto@soton.ac.uk>
Mon, 8 Apr 2019 10:37:38 +0000 (11:37 +0100)
widget/cal.lua
widget/contrib/tp_smapi.lua
widget/fs.lua
widget/weather.lua
wiki

index 9b613bf6cf08b361a0b3cad062fa7208a6d51697..2482ccb9a078744f09c17e4203ce5b0d6020a492 100644 (file)
@@ -14,6 +14,7 @@ local os       = os
 local pairs    = pairs
 local string   = string
 local tconcat  = table.concat
 local pairs    = pairs
 local string   = string
 local tconcat  = table.concat
+local type     = type
 local tonumber = tonumber
 local tostring = tostring
 
 local tonumber = tonumber
 local tostring = tostring
 
@@ -80,7 +81,7 @@ local function factory(args)
         cal.notification = nil
     end
 
         cal.notification = nil
     end
 
-    function cal.show(timeout, month, year, scr)
+    function cal.show(seconds, month, year, scr)
         cal.notification_preset.text = tconcat(cal.build(month, year))
 
         if cal.three then
         cal.notification_preset.text = tconcat(cal.build(month, year))
 
         if cal.three then
@@ -98,7 +99,7 @@ local function factory(args)
             preset  = cal.notification_preset,
             screen  = cal.followtag and awful.screen.focused() or scr or 1,
             icon    = cal.icon,
             preset  = cal.notification_preset,
             screen  = cal.followtag and awful.screen.focused() or scr or 1,
             icon    = cal.icon,
-            timeout = timeout or cal.notification_preset.timeout or 5
+            timeout = type(seconds) == "number" and seconds or cal.notification_preset.timeout or 5
         }
     end
 
         }
     end
 
index 4f43e44a8b401d91c805686a3e78ef640d5df443..b8acbe2cdedf0bc033ccbc122da943eba38be619 100644 (file)
@@ -12,6 +12,7 @@ local gears   = require("gears")
 local naughty = require("naughty")
 local wibox   = require("wibox")
 local string  = string
 local naughty = require("naughty")
 local wibox   = require("wibox")
 local string  = string
+local type    = type
 
 -- ThinkPad battery infos and widget creator
 -- http://www.thinkwiki.org/wiki/Tp_smapi
 
 -- ThinkPad battery infos and widget creator
 -- http://www.thinkwiki.org/wiki/Tp_smapi
@@ -73,7 +74,7 @@ local function factory(apipath)
         tp_smapi.notification = naughty.notify {
             title   = string.format("%s: %s %s (%s)", batid, mfgr, model, chem),
             text    = msg,
         tp_smapi.notification = naughty.notify {
             title   = string.format("%s: %s %s (%s)", batid, mfgr, model, chem),
             text    = msg,
-            timeout = seconds or 0,
+            timeout = type(seconds) == "number" and seconds or 0,
             screen  = scr or focused()
         }
     end
             screen  = scr or focused()
         }
     end
index d1b7a971a3d1e7ac0540cb3ef1abc5fdd5a5d631..fcc6a26a733132d0be9ef6b119862a1a50f5fc93 100644 (file)
@@ -15,6 +15,7 @@ local naughty    = require("naughty")
 local math       = math
 local string     = string
 local tconcat    = table.concat
 local math       = math
 local string     = string
 local tconcat    = table.concat
+local type       = type
 local tonumber   = tonumber
 local query_size = Gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE
 local query_free = Gio.FILE_ATTRIBUTE_FILESYSTEM_FREE
 local tonumber   = tonumber
 local query_size = Gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE
 local query_free = Gio.FILE_ATTRIBUTE_FILESYSTEM_FREE
@@ -45,7 +46,7 @@ local function factory(args)
         fs.notification_preset.screen = fs.followtag and focused() or scr or 1
         fs.notification = naughty.notify {
             preset  = fs.notification_preset,
         fs.notification_preset.screen = fs.followtag and focused() or scr or 1
         fs.notification = naughty.notify {
             preset  = fs.notification_preset,
-            timeout = seconds or 5
+            timeout = type(seconds) == "number" and seconds or 5
         }
     end
 
         }
     end
 
index f35ca68b2e72ffb7e6326744197753d117ffcc62..c998ed9754f8873e75ea1073620faa10a6e9a3ed 100644 (file)
@@ -13,6 +13,7 @@ local wibox    = require("wibox")
 local math     = math
 local os       = os
 local string   = string
 local math     = math
 local os       = os
 local string   = string
+local type     = type
 local tonumber = tonumber
 
 -- OpenWeatherMap
 local tonumber = tonumber
 
 -- OpenWeatherMap
@@ -51,7 +52,7 @@ local function factory(args)
     weather.icon_path = icons_path .. "na.png"
     weather.icon = wibox.widget.imagebox(weather.icon_path)
 
     weather.icon_path = icons_path .. "na.png"
     weather.icon = wibox.widget.imagebox(weather.icon_path)
 
-    function weather.show(t_out)
+    function weather.show(seconds)
         weather.hide()
 
         if followtag then
         weather.hide()
 
         if followtag then
@@ -63,12 +64,12 @@ local function factory(args)
             weather.forecast_update()
         end
 
             weather.forecast_update()
         end
 
-        weather.notification = naughty.notify({
+        weather.notification = naughty.notify {
+            preset  = notification_preset,
             text    = weather.notification_text,
             icon    = weather.icon_path,
             text    = weather.notification_text,
             icon    = weather.icon_path,
-            timeout = t_out,
-            preset  = notification_preset
-        })
+            timeout = type(seconds == "number") and seconds or notification_preset.timeout
+        }
     end
 
     function weather.hide()
     end
 
     function weather.hide()
diff --git a/wiki b/wiki
index 7a994596603c2129ae18dd2de69f765e2838c2cd..50fc0e4d153f67f105633b5bf1bda232155d5140 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit 7a994596603c2129ae18dd2de69f765e2838c2cd
+Subproject commit 50fc0e4d153f67f105633b5bf1bda232155d5140