summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-23 14:33:12 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-23 14:33:12 +0200
commitb1a919108e3c447bbcbb7c0110663713b7c9b83c (patch)
tree4f5964698bee8ce728f1084c6a94f2ce71687453 /src/app.c
parent0fdf297a5750f736eddbdbfe73cdb86522cb302c (diff)
Option to auto-reload a tab at a given interval
IssueID #116
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c11
1 files changed, 10 insertions, 1 deletions
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 {
126 iStringList *launchCommands; 126 iStringList *launchCommands;
127 iBool isFinishedLaunching; 127 iBool isFinishedLaunching;
128 iTime lastDropTime; /* for detecting drops of multiple items */ 128 iTime lastDropTime; /* for detecting drops of multiple items */
129 int autoReloadTimer;
129 /* Preferences: */ 130 /* Preferences: */
130 iBool commandEcho; /* --echo */ 131 iBool commandEcho; /* --echo */
131 iBool forceSoftwareRender; /* --sw */ 132 iBool forceSoftwareRender; /* --sw */
@@ -414,6 +415,12 @@ static uint32_t checkAsleep_App_(uint32_t interval, void *param) {
414} 415}
415#endif 416#endif
416 417
418static uint32_t postAutoReloadCommand_App_(uint32_t interval, void *param) {
419 iUnused(param);
420 postCommand_App("document.autoreload");
421 return interval;
422}
423
417static void init_App_(iApp *d, int argc, char **argv) { 424static void init_App_(iApp *d, int argc, char **argv) {
418 init_CommandLine(&d->args, argc, argv); 425 init_CommandLine(&d->args, argc, argv);
419 /* Where was the app started from? We ask SDL first because the command line alone is 426 /* 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) {
512 postCommand_App("open url:about:help"); 519 postCommand_App("open url:about:help");
513 } 520 }
514 postCommand_App("window.unfreeze"); 521 postCommand_App("window.unfreeze");
515 d->isFinishedLaunching = iTrue; 522 d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL);
523 postCommand_App("document.autoreload");
524 d->isFinishedLaunching = iTrue;
516 /* Run any commands that were pending completion of launch. */ { 525 /* Run any commands that were pending completion of launch. */ {
517 iForEach(StringList, i, d->launchCommands) { 526 iForEach(StringList, i, d->launchCommands) {
518 postCommandString_App(i.value); 527 postCommandString_App(i.value);