diff options
| author | miguel <miguel@localhost> | 2018-03-19 18:08:18 +0100 |
|---|---|---|
| committer | miguel <miguel@localhost> | 2018-03-19 18:08:18 +0100 |
| commit | 47757191f41251b5de0c84abe891624bde02aa72 (patch) | |
| tree | c50b814018c665570f2265a7ca78565ddca48d82 /surf.c | |
| parent | 45b074d24577b7ba2aa7b0e5e0d799b3ddcd5cbb (diff) | |
paste uri and open in new window
Diffstat (limited to 'surf.c')
| -rw-r--r-- | surf.c | 27 |
1 files changed, 23 insertions, 4 deletions
@@ -214,6 +214,7 @@ static void destroywin(GtkWidget* w, Client *c); /* Hotkeys */ static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); +static void pasteurinew(GtkClipboard *clipboard, const char *text, gpointer d); static void reload(Client *c, const Arg *a); static void print(Client *c, const Arg *a); static void showcert(Client *c, const Arg *a); @@ -1707,7 +1708,22 @@ pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) } loaduri((Client *) d, &a); } +} +void +pasteurinew(GtkClipboard *clipboard, const char *text, gpointer d) +{ + char buf[1024]; + Arg a = {.v = text }; + if (text) + { + if (strstr(text, ".") == NULL) { + snprintf(buf,1024,"https://duckduckgo.com/?q=%s",text); + a.v = buf; + printf("%s\n",buf); + } + piper_recv(buf); + } } void @@ -1753,10 +1769,15 @@ showcert(Client *c, const Arg *a) void clipboard(Client *c, const Arg *a) { - if (a->i) { /* load clipboard uri */ + if (a->i==1) { /* load clipboard uri */ gtk_clipboard_request_text(gtk_clipboard_get( GDK_SELECTION_PRIMARY), pasteuri, c); + }else if (a->i==2) { /* load clipboard uri */ + gtk_clipboard_request_text(gtk_clipboard_get( + GDK_SELECTION_PRIMARY), + pasteurinew, c); + } else { /* copy uri */ gtk_clipboard_set_text(gtk_clipboard_get( GDK_SELECTION_PRIMARY), c->targeturi @@ -1931,7 +1952,7 @@ clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h) void piper_recv(char *msg) { - g_print("message from extension: [%s]\n",msg); + g_print("message receieved [%s]\n",msg); Arg a; a.v=msg; @@ -1940,8 +1961,6 @@ piper_recv(char *msg) loaduri(c, &a); updatetitle(c); - - } int |
