diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-21 12:09:36 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-21 12:17:00 +0300 |
commit | d7d3ce9e44dd96a40b3ec3740b777f0bd35a103e (patch) | |
tree | 1fc255ecca3c64fea0d684b53edc9467faee1242 | |
parent | f033188b8103135b4e4ce1746bfc26a527323ba8 (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
-rw-r--r-- | res/arg-help.txt | 4 | ||||
-rw-r--r-- | src/app.c | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/res/arg-help.txt b/res/arg-help.txt index d8e8c76c..7fe393c1 100644 --- a/res/arg-help.txt +++ b/res/arg-help.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Usage: lagrange [options] [URLs] [paths] | 1 | Usage: lagrange [options] [URLs] [paths] |
2 | 2 | ||
3 | URLs and local files are opened in separate tabs. By default the first | 3 | When multiple URLs and local files are specified, they are opened in |
4 | URL/path opens in the currently open tab. | 4 | separate tabs. |
5 | 5 | ||
6 | General options: | 6 | General options: |
7 | 7 | ||
@@ -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)); |