diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 5f260145d..95c24d21e 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -838,6 +838,14 @@ void createMainWindow(struct Application *app) { app->mainWindow = mainWindow; } +const char* getInitialState(struct Application *app) { + if( isDarkMode(app) ) { + return "window.wails.System.IsDarkMode.set(true);"; + } else { + return "window.wails.System.IsDarkMode.set(false);"; + } +} + void Run(struct Application *app, int argc, char **argv) { processDecorations(app); @@ -944,6 +952,11 @@ void Run(struct Application *app, int argc, char **argv) { const char *internalCode = concat(temp, (const char*)&runtime); free((void*)temp); + // Add code that sets up the initial state, EG: State Stores. + temp = concat(internalCode, getInitialState(app)); + free((void*)internalCode); + internalCode = temp; + // Loop over assets and build up one giant Mother Of All Evals int index = 1; while(1) {