diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -545,6 +545,7 @@ static void terminate_App_(int rc) { | |||
545 | static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | 545 | static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, |
546 | const iStringList *openCmds) { | 546 | const iStringList *openCmds) { |
547 | iString *cmds = new_String(); | 547 | iString *cmds = new_String(); |
548 | iBool requestRaise = iFalse; | ||
548 | const iProcessId pid = currentId_Process(); | 549 | const iProcessId pid = currentId_Process(); |
549 | iConstForEach(CommandLine, i, &d->args) { | 550 | iConstForEach(CommandLine, i, &d->args) { |
550 | if (i.argType == value_CommandLineArgType) { | 551 | if (i.argType == value_CommandLineArgType) { |
@@ -552,6 +553,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
552 | } | 553 | } |
553 | if (equal_CommandLineConstIterator(&i, "go-home")) { | 554 | if (equal_CommandLineConstIterator(&i, "go-home")) { |
554 | appendCStr_String(cmds, "navigate.home\n"); | 555 | appendCStr_String(cmds, "navigate.home\n"); |
556 | requestRaise = iTrue; | ||
555 | } | 557 | } |
556 | else if (equal_CommandLineConstIterator(&i, "new-tab")) { | 558 | else if (equal_CommandLineConstIterator(&i, "new-tab")) { |
557 | iCommandLineArg *arg = argument_CommandLineConstIterator(&i); | 559 | iCommandLineArg *arg = argument_CommandLineConstIterator(&i); |
@@ -563,6 +565,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
563 | appendCStr_String(cmds, "tabs.new\n"); | 565 | appendCStr_String(cmds, "tabs.new\n"); |
564 | } | 566 | } |
565 | iRelease(arg); | 567 | iRelease(arg); |
568 | requestRaise = iTrue; | ||
566 | } | 569 | } |
567 | else if (equal_CommandLineConstIterator(&i, "close-tab")) { | 570 | else if (equal_CommandLineConstIterator(&i, "close-tab")) { |
568 | appendCStr_String(cmds, "tabs.close\n"); | 571 | appendCStr_String(cmds, "tabs.close\n"); |
@@ -577,9 +580,10 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
577 | if (isEmpty_String(cmds)) { | 580 | if (isEmpty_String(cmds)) { |
578 | /* By default open a new tab. */ | 581 | /* By default open a new tab. */ |
579 | appendCStr_String(cmds, "tabs.new\n"); | 582 | appendCStr_String(cmds, "tabs.new\n"); |
583 | requestRaise = iTrue; | ||
580 | } | 584 | } |
581 | if (!isEmpty_String(cmds)) { | 585 | if (!isEmpty_String(cmds)) { |
582 | iString *result = communicate_Ipc(cmds); | 586 | iString *result = communicate_Ipc(cmds, requestRaise); |
583 | if (result) { | 587 | if (result) { |
584 | fwrite(cstr_String(result), 1, size_String(result), stdout); | 588 | fwrite(cstr_String(result), 1, size_String(result), stdout); |
585 | fflush(stdout); | 589 | fflush(stdout); |
@@ -2507,6 +2511,11 @@ iBool handleCommand_App(const char *cmd) { | |||
2507 | return iTrue; | 2511 | return iTrue; |
2508 | } | 2512 | } |
2509 | else if (equal_Command(cmd, "ipc.signal")) { | 2513 | else if (equal_Command(cmd, "ipc.signal")) { |
2514 | if (argLabel_Command(cmd, "raise")) { | ||
2515 | if (d->window && d->window->win) { | ||
2516 | SDL_RaiseWindow(d->window->win); | ||
2517 | } | ||
2518 | } | ||
2510 | signal_Ipc(arg_Command(cmd)); | 2519 | signal_Ipc(arg_Command(cmd)); |
2511 | return iTrue; | 2520 | return iTrue; |
2512 | } | 2521 | } |