diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-01 09:11:20 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-01 09:11:20 +0200 |
commit | 4b4884dd7cdbce7194fec24e782dd09d3c430a8f (patch) | |
tree | d4e49ee296568f1ad3962401af6447f74ea219c0 | |
parent | 08279486f60cbd81bda35e0fb8ed418b821ec8a6 (diff) |
Listing open tabs via command line
IssueID #178
-rw-r--r-- | src/app.c | 8 | ||||
-rw-r--r-- | src/app.h | 3 |
2 files changed, 9 insertions, 2 deletions
@@ -449,7 +449,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
449 | else if (equal_CommandLineConstIterator(&i, "close-tab")) { | 449 | else if (equal_CommandLineConstIterator(&i, "close-tab")) { |
450 | appendCStr_String(cmds, "tabs.close\n"); | 450 | appendCStr_String(cmds, "tabs.close\n"); |
451 | } | 451 | } |
452 | else if (equal_CommandLineConstIterator(&i, "list-tab-urls;L")) { | 452 | else if (equal_CommandLineConstIterator(&i, listTabUrls_CommandLineOption)) { |
453 | appendFormat_String(cmds, "ipc.list.urls pid:%d\n", pid); | 453 | appendFormat_String(cmds, "ipc.list.urls pid:%d\n", pid); |
454 | } | 454 | } |
455 | } | 455 | } |
@@ -481,7 +481,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
481 | defineValues_CommandLine(&d->args, "echo;E", 0); | 481 | defineValues_CommandLine(&d->args, "echo;E", 0); |
482 | defineValues_CommandLine(&d->args, "go-home", 0); | 482 | defineValues_CommandLine(&d->args, "go-home", 0); |
483 | defineValues_CommandLine(&d->args, "help", 0); | 483 | defineValues_CommandLine(&d->args, "help", 0); |
484 | defineValues_CommandLine(&d->args, "list-tab-urls;L", 0); | 484 | defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0); |
485 | defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); | 485 | defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); |
486 | defineValues_CommandLine(&d->args, "sw", 0); | 486 | defineValues_CommandLine(&d->args, "sw", 0); |
487 | defineValues_CommandLine(&d->args, "version;V", 0); | 487 | defineValues_CommandLine(&d->args, "version;V", 0); |
@@ -549,6 +549,10 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
549 | communicateWithRunningInstance_App_(d, instance, openCmds); | 549 | communicateWithRunningInstance_App_(d, instance, openCmds); |
550 | terminate_App_(0); | 550 | terminate_App_(0); |
551 | } | 551 | } |
552 | /* Some options are intended only for controlling other instances. */ | ||
553 | if (contains_CommandLine(&d->args, listTabUrls_CommandLineOption)) { | ||
554 | terminate_App_(0); | ||
555 | } | ||
552 | listen_Ipc(); /* We'll respond to commands from other instances. */ | 556 | listen_Ipc(); /* We'll respond to commands from other instances. */ |
553 | } | 557 | } |
554 | printf("Lagrange: A Beautiful Gemini Client\n"); | 558 | printf("Lagrange: A Beautiful Gemini Client\n"); |
@@ -38,6 +38,9 @@ iDeclareType(MimeHooks) | |||
38 | iDeclareType(Visited) | 38 | iDeclareType(Visited) |
39 | iDeclareType(Window) | 39 | iDeclareType(Window) |
40 | 40 | ||
41 | /* Command line options strings. */ | ||
42 | #define listTabUrls_CommandLineOption "list-tab-urls;L" | ||
43 | |||
41 | enum iAppDeviceType { | 44 | enum iAppDeviceType { |
42 | desktop_AppDeviceType, | 45 | desktop_AppDeviceType, |
43 | tablet_AppDeviceType, | 46 | tablet_AppDeviceType, |