diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -339,6 +339,22 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
339 | postCommandString_App(i.value); | 339 | postCommandString_App(i.value); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | /* URLs from the command line. */ { | ||
343 | iBool newTab = iFalse; | ||
344 | for (size_t i = 1; i < size_StringList(args_CommandLine(&d->args)); i++) { | ||
345 | const iString *arg = constAt_StringList(args_CommandLine(&d->args), i); | ||
346 | const iBool isKnownScheme = | ||
347 | startsWithCase_String(arg, "gemini:") || startsWithCase_String(arg, "file:") || | ||
348 | startsWithCase_String(arg, "data:") || startsWithCase_String(arg, "about:"); | ||
349 | if (isKnownScheme || fileExists_FileInfo(arg)) { | ||
350 | postCommandf_App("open newtab:%d url:%s%s", | ||
351 | newTab, | ||
352 | isKnownScheme ? "" : "file://", | ||
353 | cstr_String(arg)); | ||
354 | newTab = iTrue; | ||
355 | } | ||
356 | } | ||
357 | } | ||
342 | } | 358 | } |
343 | 359 | ||
344 | static void deinit_App(iApp *d) { | 360 | static void deinit_App(iApp *d) { |