summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/surf.c b/surf.c
index 68a1930..e1420b0 100644
--- a/surf.c
+++ b/surf.c
@@ -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