Add -reload-theme CLI flag to re-apply the current theme file (#860)
* Add -reload-theme CLI flag to re-apply theme via IPC Sends a reload-theme IPC message to a running instance, causing it to call fyne.CurrentApp().Settings().SetTheme(m.theme). Follows the same callback pattern as -show (OnReactivate) and quit (OnExit). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * actually re-read theme file --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
497c61e724
commit
e21908cd24
@@ -273,6 +273,11 @@ func (m *MainWindow) setInitialSize() {
|
||||
m.Window.Resize(m.DesiredSize())
|
||||
}
|
||||
|
||||
func (m *MainWindow) ReloadTheme() {
|
||||
m.theme.ReloadThemeFile()
|
||||
fyne.CurrentApp().Settings().SetTheme(m.theme)
|
||||
}
|
||||
|
||||
func (m *MainWindow) StartupPage() controller.Route {
|
||||
switch m.App.Config.Application.StartupPage {
|
||||
case "Artists":
|
||||
|
||||
@@ -110,6 +110,11 @@ func NewMyTheme(config *backend.ThemeConfig, themeFileDir string) *MyTheme {
|
||||
return m
|
||||
}
|
||||
|
||||
// ReloadThemeFile reloads the currently loaded theme file.
|
||||
func (m *MyTheme) ReloadThemeFile() {
|
||||
m.loadedThemeFile = nil
|
||||
}
|
||||
|
||||
func (m *MyTheme) Color(name fyne.ThemeColorName, defVariant fyne.ThemeVariant) color.Color {
|
||||
// load theme file if necessary
|
||||
if m.loadedThemeFile == nil || m.config.ThemeFile != m.loadedThemeFilename {
|
||||
|
||||
Reference in New Issue
Block a user