Files
aiolauncher_scripts/main/calendar-search.lua
2022-08-22 10:24:40 +03:00

27 lines
600 B
Lua

-- name = "Calendar"
-- description = "Calendar search script"
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
-- type = "search"
local events = calendar:get_events()
local results = {}
function on_search(str)
results = {}
buttons = {}
for _,event in pairs(events) do
if event.title:lower():find(str:lower()) ~= nil then
table.insert(results, event)
table.insert(buttons, event.title)
end
end
search:show(buttons)
end
function on_click(idx)
--calendar:show_event_dialog(results[idx].id)
calendar:open_event(results[idx].id)
end