mothra: add "d" command to search for a text on the internet (using duckduckgo)

This commit is contained in:
Sigrid 2021-03-02 08:21:56 +01:00
parent f234b29c7f
commit 2aba7615af
2 changed files with 15 additions and 0 deletions

View file

@ -132,6 +132,11 @@ The typed commands are:
.B a
Toggle alt display.
.TP
.BI d " text
Search for the given
.I text
on the internet.
.TP
.BI g " url
Go to the page with the given URL.
.TP

View file

@ -675,6 +675,16 @@ void docmd(Panel *p, char *s){
if(*s=='\0' && selection)
hit3(3, 0);
break;
case 'd':
s = arg(s);
if(*s){
s = smprint("https://duckduckgo.com/html/?q=%U", s);
if(s != nil)
geturl(s, -1, 0, 0);
free(s);
}else
message("Usage: d text");
break;
case 'g':
s = arg(s);
if(*s=='\0'){