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:
Drew Weymouth
2026-02-17 16:56:51 -08:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 497c61e724
commit e21908cd24
8 changed files with 39 additions and 9 deletions
+11 -1
View File
@@ -60,6 +60,7 @@ type App struct {
// UI callbacks to be set in main
OnReactivate func()
OnExit func()
OnReloadTheme func()
appName string
displayAppName string
@@ -227,7 +228,8 @@ func StartupApp(appName, displayAppName, appVersion, appVersionTag, latestReleas
ipcRatingHandler,
a.ServerManager,
a.callOnReactivate,
func() { _ = a.callOnExit() })
func() { _ = a.callOnExit() },
a.callOnReloadTheme)
go a.ipcServer.Serve(listener)
} else {
log.Printf("error starting IPC server: %s", err.Error())
@@ -336,6 +338,12 @@ func (a *App) callOnReactivate() {
}
}
func (a *App) callOnReloadTheme() {
if a.OnReloadTheme != nil {
a.OnReloadTheme()
}
}
func (a *App) callOnExit() error {
if a.OnExit == nil {
return errors.New("no quit handler registered")
@@ -658,6 +666,8 @@ func (a *App) checkFlagsAndSendIPCMsg(cli *ipc.Client) error {
return cli.PauseAfterCurrent()
case *FlagShow:
return cli.Show()
case *FlagReloadTheme:
return cli.ReloadTheme()
case VolumeCLIArg >= 0:
return cli.SetVolume(VolumeCLIArg)
case VolumePctCLIArg != 0: