cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 8cac260a4b7c0b4df4d1229a5e41e64c3a687173
parent 26666e7838fd40ca7d6f20af7e0cb554ff8bb0f0
Author: René Wagner <rwagner@rw-net.de>
Date:   Sun,  7 Feb 2021 11:17:45 +0100

'e' command without [N] sends current URL to external

closes #6

Diffstat:
Msrc/gmnlm.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -82,6 +82,7 @@ const char *help_msg = "<url>\t\tgo to url\n" "[N]\t\tFollow Nth link (where N is a number)\n" "p[N]\t\tPrint URL of Nth link (where N is a number)\n" + "e\t\tSend current URL of browser to external default program\n" "e[N]\t\tSend URL of Nth link in external default program\n" "t[N]\t\tDownload content of Nth link to a temporary file\n" "b[N]\t\tJump back N entries in history, N is optional, default 1\n" @@ -645,7 +646,16 @@ do_prompts(const char *prompt, struct browser *browser) case 'e': case 'p': case 't': - if (!in[1]) break; + if (!in[1]) { + if (in[0] == 'e') { + char xdgopen[4096]; + snprintf(xdgopen, sizeof(xdgopen), "xdg-open %s", browser->plain_url); + if ( !system(xdgopen) ) fprintf(browser->tty, "Link send to xdg-open\n"); + goto exit; + } else { + break; + } + } linksel = (int)strtol(in+1, &endptr, 10); if (!endptr[0] && linksel >= 0) { while (linksel > 0 && link) {