summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-21 12:09:36 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-21 12:17:00 +0300
commitd7d3ce9e44dd96a40b3ec3740b777f0bd35a103e (patch)
tree1fc255ecca3c64fea0d684b53edc9467faee1242 /src/app.c
parentf033188b8103135b4e4ce1746bfc26a527323ba8 (diff)
Behavior of opening URLs via command line
Open all URLs/files specified on the command line in new tabs, and raise the window if the app is already running. IssueID #235
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/app.c b/src/app.c
index 591b2cef..e0fe66df 100644
--- a/src/app.c
+++ b/src/app.c
@@ -576,6 +576,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,
576 } 576 }
577 if (!isEmpty_StringList(openCmds)) { 577 if (!isEmpty_StringList(openCmds)) {
578 append_String(cmds, collect_String(joinCStr_StringList(openCmds, "\n"))); 578 append_String(cmds, collect_String(joinCStr_StringList(openCmds, "\n")));
579 requestRaise = iTrue;
579 } 580 }
580 if (isEmpty_String(cmds)) { 581 if (isEmpty_String(cmds)) {
581 /* By default open a new tab. */ 582 /* By default open a new tab. */
@@ -647,7 +648,6 @@ static void init_App_(iApp *d, int argc, char **argv) {
647 terminate_App_(0); 648 terminate_App_(0);
648 } 649 }
649 /* Check for URLs. */ 650 /* Check for URLs. */
650 iBool newTab = iFalse;
651 iConstForEach(CommandLine, i, &d->args) { 651 iConstForEach(CommandLine, i, &d->args) {
652 const iRangecc arg = i.entry; 652 const iRangecc arg = i.entry;
653 if (i.argType == value_CommandLineArgType) { 653 if (i.argType == value_CommandLineArgType) {
@@ -662,9 +662,8 @@ static void init_App_(iApp *d, int argc, char **argv) {
662 : makeFileUrl_String(collectNewRange_String(arg)); 662 : makeFileUrl_String(collectNewRange_String(arg));
663 pushBack_StringList(openCmds, 663 pushBack_StringList(openCmds,
664 collectNewFormat_String( 664 collectNewFormat_String(
665 "open newtab:%d url:%s", newTab, cstr_String(decUrl))); 665 "open newtab:1 url:%s", cstr_String(decUrl)));
666 delete_String(decUrl); 666 delete_String(decUrl);
667 newTab = iTrue;
668 } 667 }
669 else { 668 else {
670 fprintf(stderr, "Invalid URL/file: %s\n", cstr_Rangecc(arg)); 669 fprintf(stderr, "Invalid URL/file: %s\n", cstr_Rangecc(arg));