mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-09 00:29:13 +08:00
Support setting app state at startup
This commit is contained in:
parent
f4943bc26c
commit
6aae2eb1df
@ -838,6 +838,14 @@ void createMainWindow(struct Application *app) {
|
|||||||
app->mainWindow = mainWindow;
|
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) {
|
void Run(struct Application *app, int argc, char **argv) {
|
||||||
|
|
||||||
processDecorations(app);
|
processDecorations(app);
|
||||||
@ -944,6 +952,11 @@ void Run(struct Application *app, int argc, char **argv) {
|
|||||||
const char *internalCode = concat(temp, (const char*)&runtime);
|
const char *internalCode = concat(temp, (const char*)&runtime);
|
||||||
free((void*)temp);
|
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
|
// Loop over assets and build up one giant Mother Of All Evals
|
||||||
int index = 1;
|
int index = 1;
|
||||||
while(1) {
|
while(1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user