summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authormiguel <miguel@localhost>2018-03-16 01:19:49 +0100
committermiguel <miguel@localhost>2018-03-16 01:19:49 +0100
commit6d09938230f85faebe2acaf6f54496117f5dbe34 (patch)
treed5f0b453f8855fc96d4567e83a82a30bd284e473 /surf.c
parent9de609b8bb4e3624416a4fad47eaf820d870ac9c (diff)
modal keybindings and window spawning in existing process
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/surf.c b/surf.c
index 4357b22..ffd4f0a 100644
--- a/surf.c
+++ b/surf.c
@@ -232,7 +232,7 @@ static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h);
static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h);
static char winid[64];
-static char togglestats[12];
+static char togglestats[13];
static char pagestats[2];
static Atom atoms[AtomLast];
static Window embed;
@@ -633,7 +633,8 @@ gettogglestats(Client *c)
togglestats[8] = curconfig[FrameFlattening].val.i ? 'F' : 'f';
togglestats[9] = curconfig[Certificate].val.i ? 'X' : 'x';
togglestats[10] = curconfig[StrictTLS].val.i ? 'T' : 't';
- togglestats[11] = '\0';
+ togglestats[11] = curconfig[KioskMode].val.i ? 'K' : 'k';
+ togglestats[12] = '\0';
}
void
@@ -1267,7 +1268,7 @@ winevent(GtkWidget *w, GdkEvent *e, Client *c)
updatetitle(c);
break;
case GDK_KEY_PRESS:
- if (!curconfig[KioskMode].val.i) {
+ if (!curconfig[KioskMode].val.i ^ e->key.keyval==GDK_KEY_Escape) {
for (i = 0; i < LENGTH(keys); ++i) {
if (gdk_keyval_to_lower(e->key.keyval) ==
keys[i].keyval &&
@@ -1692,9 +1693,18 @@ destroywin(GtkWidget* w, Client *c)
void
pasteuri(GtkClipboard *clipboard, const char *text, gpointer d)
{
+ char buf[1024];
Arg a = {.v = text };
if (text)
- loaduri((Client *) d, &a);
+ {
+ if (strstr(text, ".") == NULL) {
+ snprintf(buf,1024,"https://duckduckgo.com/?q=%s",text);
+ a.v = buf;
+ printf("%s\n",buf);
+ }
+ loaduri((Client *) d, &a);
+ }
+
}
void
@@ -1795,6 +1805,12 @@ scroll(Client *c, const Arg *a)
case 'u':
ev->key.keyval = GDK_KEY_Up;
break;
+ case 'H':
+ ev->key.keyval = GDK_KEY_Home;
+ break;
+ case 'E':
+ ev->key.keyval = GDK_KEY_End;
+ break;
}
gdk_event_put(ev);
@@ -1820,6 +1836,7 @@ toggle(Client *c, const Arg *a)
{
curconfig[a->i].val.i ^= 1;
setparameter(c, 1, (ParamName)a->i, &curconfig[a->i].val);
+ updatetitle(c);
}
void
@@ -1912,6 +1929,16 @@ void
piper_recv(char *msg)
{
g_print("message from extension: [%s]\n",msg);
+ Arg a;
+ a.v=msg;
+
+ Client *c = newclient(clients);
+ showview(NULL, c);
+
+ loaduri(c, &a);
+ updatetitle(c);
+
+
}
int
@@ -2056,7 +2083,7 @@ main(int argc, char *argv[])
else
arg.v = "about:blank";
- piper_init("ext-to-surf","surf-to-ext",piper_recv);
+ piper_init("ext-to-surf","surf-to-ext",piper_recv,arg.v);
setup();
c = newclient(NULL);
showview(NULL, c);