From b1a919108e3c447bbcbb7c0110663713b7c9b83c Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 23 Feb 2021 14:33:12 +0200 Subject: Option to auto-reload a tab at a given interval IssueID #116 --- src/app.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/app.c') diff --git a/src/app.c b/src/app.c index 10557370..929cc8a2 100644 --- a/src/app.c +++ b/src/app.c @@ -126,6 +126,7 @@ struct Impl_App { iStringList *launchCommands; iBool isFinishedLaunching; iTime lastDropTime; /* for detecting drops of multiple items */ + int autoReloadTimer; /* Preferences: */ iBool commandEcho; /* --echo */ iBool forceSoftwareRender; /* --sw */ @@ -414,6 +415,12 @@ static uint32_t checkAsleep_App_(uint32_t interval, void *param) { } #endif +static uint32_t postAutoReloadCommand_App_(uint32_t interval, void *param) { + iUnused(param); + postCommand_App("document.autoreload"); + return interval; +} + static void init_App_(iApp *d, int argc, char **argv) { init_CommandLine(&d->args, argc, argv); /* Where was the app started from? We ask SDL first because the command line alone is @@ -512,7 +519,9 @@ static void init_App_(iApp *d, int argc, char **argv) { postCommand_App("open url:about:help"); } postCommand_App("window.unfreeze"); - d->isFinishedLaunching = iTrue; + d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); + postCommand_App("document.autoreload"); + d->isFinishedLaunching = iTrue; /* Run any commands that were pending completion of launch. */ { iForEach(StringList, i, d->launchCommands) { postCommandString_App(i.value); -- cgit v1.2.3