Check whether calendar_popup exists rather than awesome.version
It may happen that the version string on certain builds of awesome is **not** "v.4.2" but just "4.2". This makes the existing check ineffective. Moreover, the calendar API is likely to be kept in further releases of Awesome. The current code would fail e.g. for version 4.2.1 or 4.3 It's much more effective checking whether the calendar API exists on awful.widget rather than trying to check the version of awesome.
This commit is contained in:
parent
057d7bbe9d
commit
761bb2fa12
|
@ -33,10 +33,9 @@ local tonumber = tonumber
|
|||
local awesome = awesome -- luacheck: ignore
|
||||
local awful = require("awful")
|
||||
|
||||
|
||||
local calendar
|
||||
|
||||
if awesome.version:sub(1, 4) == "v4.2" then
|
||||
if awful.widget.calendar_popup then
|
||||
calendar = awful.widget.calendar_popup.month({position="tr"})
|
||||
function calendar:register(widget)
|
||||
self:attach(widget, "tr")
|
||||
|
|
Loading…
Reference in New Issue