diff --git a/community/profiles-dumper-widget.lua b/community/profiles-dumper-widget.lua new file mode 100644 index 0000000..8f4e87f --- /dev/null +++ b/community/profiles-dumper-widget.lua @@ -0,0 +1,16 @@ +-- name = "Profiles auto dumper" +-- description = "Hidden widget that auto dump profile on every return to the home screen" +-- type = "widget" +-- author = "Evgeny Zobnin (zobnin@gmail.com)" +-- version = "1.0" +-- foldable = "false" + +local prof_name = "Auto dumped" + +function on_load() + ui:hide_widget() +end + +function on_resume() + profiles:dump(prof_name) +end diff --git a/community/profiles-restore-save-widget.lua b/community/profiles-restore-save-widget.lua new file mode 100644 index 0000000..f4c0c33 --- /dev/null +++ b/community/profiles-restore-save-widget.lua @@ -0,0 +1,35 @@ +-- name = "Profile Switcher" +-- version = "1.0" +-- description = "Tap: restore profile / Long-press: save to profile" +-- type = "widget" +-- author = "Marcus Johansson" + +local profs +local profile + +function on_load() + profs = profiles:list() + ui:show_buttons(profs) +end + +function on_click(idx) + profile = profs[idx] + profiles:restore(profile) + ui:show_toast(profile..": Restored") +end + +function on_long_click(idx) + profile = profs[idx] + title = 'Save to "'..profile..'" ?' + text = 'Do you want to save the current screen state to the "'..profile..'" profile ?' + ui:show_dialog(title, text, "Yes", "Cancel") +end + +function on_dialog_action(value) + if value == 1 then + profiles:dump(profile) + ui:show_toast(profile..": Saved") + elseif value == 2 then + ui:show_toast("Canceled") + end +end \ No newline at end of file