From a42cb62064b6786fb4923e2f9a68b1d1b032eefa Mon Sep 17 00:00:00 2001 From: sriramsv Date: Tue, 13 Dec 2022 22:06:53 -0800 Subject: [PATCH 1/3] Add Sunrise Sunset Widget --- community/sunrise-sunset.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 community/sunrise-sunset.lua diff --git a/community/sunrise-sunset.lua b/community/sunrise-sunset.lua new file mode 100644 index 0000000..5f3129a --- /dev/null +++ b/community/sunrise-sunset.lua @@ -0,0 +1,25 @@ +-- name = "Sunrise/Sunset" +-- description = "Shows Sunrise Sunset at your location" +-- data_source = "https://api.sunrise-sunset.org/" +-- type = "widget" +-- author = "Sriram S V" +-- version = "1.0" +-- foldable = "false" + +local json = require "json" +local date = require "date" +function on_alarm() + local location=system:location() + url="https://api.sunrise-sunset.org/json?lat="..location[1].."&lng="..location[2].."&date=today&formatted=1" + http:get(url) +end + + +function on_network_result(result) + local t = json.decode(result) + local table = { + { "sunrise:", date(t.results.sunrise):tolocal():fmt("%r") }, + { "sunset:", date(t.results.sunset):tolocal():fmt("%r") }, + } + ui:show_table(table, 2) +end \ No newline at end of file From 471afcb14cd8c2d703afbb453acbae506d9a0f74 Mon Sep 17 00:00:00 2001 From: sriramsv Date: Thu, 22 Dec 2022 11:26:36 -0800 Subject: [PATCH 2/3] Rename --- community/{sunrise-sunset.lua => sunrise-sunset-widget.lua} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename community/{sunrise-sunset.lua => sunrise-sunset-widget.lua} (100%) diff --git a/community/sunrise-sunset.lua b/community/sunrise-sunset-widget.lua similarity index 100% rename from community/sunrise-sunset.lua rename to community/sunrise-sunset-widget.lua From b0287dcea76bebf4e7811d0b1d284c73ea487294 Mon Sep 17 00:00:00 2001 From: sriramsv Date: Tue, 27 Dec 2022 23:44:31 -0800 Subject: [PATCH 3/3] Tasker Command Search --- community/tasker-command-search.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 community/tasker-command-search.lua diff --git a/community/tasker-command-search.lua b/community/tasker-command-search.lua new file mode 100644 index 0000000..93cc135 --- /dev/null +++ b/community/tasker-command-search.lua @@ -0,0 +1,25 @@ +-- name = "Tasker Command Search" +-- description = "Sends tasker command from search bar" +-- data_source = "tasker" +-- type = "search" +-- author = "Sriram SV" +-- version = "1.0" +-- prefix = "tasker | Tasker | command" + +local md_color = require "md_colors" +local orange = md_colors.orange_500 + +text_from = "" +text_to = "" + +function on_search(input) + text_from = input + text_to = "" + search:show({input},{orange}) +end + +function on_click(idx) + text_from = string.lower(text_from) + text_from=text_from:replace(" ", "=:=") + tasker:send_command(text_from) +end \ No newline at end of file