Read Wine settings live at poll and spawn

Phase 2 of the Wine/Proton stage (decisions 3, 4, 16, 17, 19 in docs/testing/wine-proton.md): replace the Wine manager's startup snapshot with a live settings source read once per poll, so accepted global settings take effect with no reader restart. The source publishes only the active/global profile's Wine values; per-application profile switching never changes the governing list. A newly listed running program restarts its helper once in the same mode; removals and clearing the global switch never downgrade a running helper.
This commit is contained in:
hjozwiak committed 2026-11-02 01:15:33 -05:00
1 parent a60a251472
commit 9a10a15b68
13 files changed
+327 -51

No files matched your search

+19 -6
View File
@@ -43,6 +43,24 @@ type remoteServiceDependencies struct {
onPreferences func()
}
// newWineManager wires the Wine manager to the reader's live settings. The
// manager reads this source at each poll and helper spawn instead of a
// startup snapshot, so preferences Apply and equivalent global-settings
// paths take effect with no reader restart. The source returns only the
// active/global profile's Wine values: per-application profile switching
// publishes through liveSettings.Store and never reaches this source.
func newWineManager(logger *slog.Logger, live *liveSettings) *wine.Manager {
manager := wine.New(logger)
manager.SettingsSource = func() wine.Settings {
if live == nil {
return wine.Settings{}
}
settings := live.LoadGlobalWine()
return wine.Settings{ControllerOnly: settings.ControllerOnly, ExcludedPrograms: settings.ExcludedPrograms}
}
return manager
}
func newRemoteRuntimeServices(deps remoteServiceDependencies) []lifecycle.Service {
remoteHandler := remoteSpeech{braille: lockFeedbackBraille{deps.braille}}
remoteHandler.live = deps.live
@@ -130,12 +148,7 @@ func newRemoteRuntimeServices(deps remoteServiceDependencies) []lifecycle.Servic
},
Stop: bridgeServer.Stop,
})
wineManager := wine.New(deps.logger)
if deps.live != nil {
settings := deps.live.Load()
wineManager.ControllerOnly = settings.Wine.ControllerOnly
wineManager.ExcludedPrograms = append([]string(nil), settings.Wine.ExcludedPrograms...)
}
wineManager := newWineManager(deps.logger, deps.live)
services = append(services, lifecycle.Service{
Name: "Wine accessibility", Start: wineManager.Start, Stop: wineManager.Stop,
})