summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorayumi <ayumi@noreply.codeberg.org>2025-04-12 14:29:07 +0200
committerayumi <ayumi@noreply.codeberg.org>2025-04-12 14:29:07 +0200
commitb8f13c804b8c253fa399e77d00c608b72a092fda (patch)
treef575aee3988fd89a76bc7409d01c86d587c68d0b /lua
parent71ac67bad3a694b2cd11450bf7bfec76a8293393 (diff)
downloadtangara-fw-b8f13c804b8c253fa399e77d00c608b72a092fda.tar.gz
Add an option to reload the current theme
Diffstat (limited to 'lua')
-rw-r--r--lua/settings.lua28
1 files changed, 21 insertions, 7 deletions
diff --git a/lua/settings.lua b/lua/settings.lua
index d60ecfda..bd5be2ee 100644
--- a/lua/settings.lua
+++ b/lua/settings.lua
@@ -406,24 +406,38 @@ settings.ThemeSettings = SettingsScreen:new {
selected_idx = idx
end
- local theme_chooser = self.content:Dropdown {
+ local theme_container = self.content:Object {
+ w = lvgl.PCT(100),
+ h = lvgl.SIZE_CONTENT,
+ flex = {
+ flex_direction = "column",
+ justify_content = "flex-start",
+ align_items = "space-evenly",
+ align_content = "flex-start",
+ },
+ pad_row = 4,
+ }
+ theme_container:add_style(styles.list_item)
+ local theme_chooser = theme_container:Dropdown {
options = options,
symbol = img.chevron,
}
-
local theme_chooser_desc = widgets.Description(theme_chooser, "Theme")
- theme_chooser:set({ selected = selected_idx })
-
- theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function()
+ local theme_reload = function()
local option = theme_chooser:get('selected_str')
local selectedTheme = themeOptions[option]
if (selectedTheme) then
theme.load_theme(tostring(selectedTheme))
backstack.reset(main_menu:new())
end
- end)
-
+ end
+ theme_chooser:set({ selected = selected_idx })
+ theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, theme_reload)
theme_chooser:focus()
+
+ local theme_reload_btn = theme_container:Button {}
+ theme_reload_btn:Label { text = "Reload" }
+ theme_reload_btn:onClicked(theme_reload)
end
}