diff options
Diffstat (limited to 'surf/config.h')
| -rw-r--r-- | surf/config.h | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/surf/config.h b/surf/config.h index 125bf31..0244695 100644 --- a/surf/config.h +++ b/surf/config.h @@ -8,7 +8,7 @@ static char *certdir = "~/.config/surf/certificates/"; static char *cachedir = "~/.config/surf/cache/"; static char *cookiefile = "~/.config/surf/cookies.txt"; static char *historyfile = "~/.config/surf/history.txt"; - +static char *searchurl = "duckduckgo.com/?q=%s"; /* Webkit default features */ /* Highest priority value will be used. @@ -48,7 +48,7 @@ static Parameter defconfig[ParameterLast] = { [SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, }, [StrictTLS] = { { .i = 1 }, }, [Style] = { { .i = 1 }, }, - [WebGL] = { { .i = 1 }, }, + [WebGL] = { { .i = 0 }, }, [ZoomLevel] = { { .f = 1.0 }, }, }; @@ -63,28 +63,33 @@ static int winsize[] = { 800, 600 }; static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | WEBKIT_FIND_OPTIONS_WRAP_AROUND; -#define SETURI(p) {.v = (char *[]){ "/bin/sh", "-c", \ - "prop=\"`tac ~/.config/surf/history.txt | sed 's/^[^ *]* //' | sort -u | dmenu -l 10 -i | cut -d ' ' -f 3`\" &&" \ - "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \ - p, winid, NULL } } + #define PROMPT_GO "Go:" #define PROMPT_FIND "Find:" -#define BM_GOTO(b) { \ - .v = (const char *[]){ "/bin/sh", "-c", \ - "cat ~/.config/surf/bookmarks | dmenu"} } - /* SETPROP(readprop, setprop, prompt)*/ #define SETPROP(r, s, p) { \ .v = (const char *[]){ "/bin/sh", "-c", \ "prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \ - "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\" && cat ~/.config/surf/bookmarks)\" " \ - "| dmenu -l 10 -p \"$4\" -w $1)\" && " \ - "xprop -id $1 -f $3 8s -set $3 \"$prop\"", \ + "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \ + "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \ "surf-setprop", winid, r, s, p, NULL \ } \ } +#define SEARCH() { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "xprop -id $1 -f $2 8s -set $2 \"" \ + "$(dmenu -p Search: -w $1 < /dev/null)\"", \ + "surf-search", winid, "_SURF_SEARCH", NULL \ + } \ +} + +#define SETURI(p) {.v = (char *[]){ "/bin/sh", "-c", \ + "prop=\"`tac ~/.config/surf/history.txt | sed 's/^[^ *]* //' | sort -u | dmenu -l 10 -i | cut -d ' ' -f 3`\" &&" \ + "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \ + p, winid, NULL } } + /* DOWNLOAD(URI, referer) */ #define DOWNLOAD(u, r) { \ .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\ @@ -111,18 +116,6 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | } \ } -/* BM_ADD(readprop) */ -#define BM_ADD(r) {\ - .v = (const char *[]){ "/bin/sh", "-c", \ - "(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \ - "| sed 's/.*https*:\\/\\/\\(www\\.\\)\\?//' && cat ~/.config/surf/bookmarks) " \ - "| awk '!seen[$0]++' > ~/.config/surf/bookmarks.tmp && " \ - "mv ~/.config/surf/bookmarks.tmp ~/.config/surf/bookmarks", \ - "notify-send Added bookmark", \ - winid, r, NULL \ - } \ -} - /* styles */ /* * The iteration will stop at the first match, beginning at the beginning of @@ -154,8 +147,9 @@ static Key keys[] = { { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) }, { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) }, { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) }, - { MODKEY, GDK_KEY_m, spawn, BM_ADD("_SURF_URI") }, - { MODKEY, GDK_KEY_e, spawn, SETURI("_SURF_GO") }, + { MODKEY, GDK_KEY_e, spawn, SETURI("__SURF_GO") }, + { MODKEY, GDK_KEY_s, spawn, SEARCH() }, + { 0, GDK_KEY_Escape, stop, { 0 } }, { MODKEY, GDK_KEY_c, stop, { 0 } }, |