7 Commits

Author SHA1 Message Date
Christoph Lohmann 3393ded725 Bumping up to 0.7 for release. 2015-12-19 15:59:30 +01:00
Christoph Lohmann cd7f831776 Remove unncessary includes. 2015-12-17 23:38:51 +01:00
Ivan Tham 86efaf8093 proxy-uri -> proxy-resolver for no_proxy; add #inc
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-12-17 23:36:56 +01:00
Ivan Tham 9fa4ffef72 Fix title handling
1. file:/// stay the same when you navigate
    2. Fix "http://~" to "file://~" in home dir
    3. Expands "file://~" to "file://home/user"

Thanks to quinq for fixing the issue #1 in commit 934705c in surf2.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-12-12 11:54:28 +01:00
Michael Stevens 002e82d188 Fix spelling of otherwise in surf.1
Add more spelling to surf.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-12-08 18:26:30 +01:00
Alexander Huemer bae5a785b3 remove duplicate header inclusion of string.h
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-11-22 12:34:54 +01:00
Ivan Tham b7a359a84f Fix cookies wording
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-11-18 08:58:18 +01:00
6 changed files with 1529 additions and 1569 deletions
+3 -27
View File
@@ -1,32 +1,8 @@
MIT/X Consortium License MIT/X Consortium License
© 2009-2010 Enno Boland <tox@s01.de> © 2011-2012 Troels Henriksen <athas@sigkill.at>
© 2009 Thomas Menari <spaceinvader@chaotika.org> © 2009-2011 Enno Boland <g s01 de>
© 2009 Simon Rozet <simon@rozet.name> © 2012 Christoph Lohmann <20h@r-36.net>
© 2009 Andrew Antle <andrew.antle@gmail.com>
© 2010-2011 pancake <nopcode.org>
© 2011-2013 Anselm R Garbe <anselm@garbe.us>
© 2011-2012 Troels Henriksen <athas@sigkill.dk>
© 2011 Connor Lane Smith <cls@lubutu.com>
© 2012-2017 Christoph Lohmann <20h@r-36.net>
© 2013 Shayan Pooya <shayan@liveve.org>
© 2013 Jens Nyberg <jens.nyberg@gmail.com>
© 2013 Carlos J. Torres <vlaadbrain@gmail.com>
© 2013 Alexander Sedov <alex0player@gmail.com>
© 2013 Nick White <git@njw.me.uk>
© 2013 David Dufberg <david@dufberg.se>
© 2014-2017 Quentin Rameau <quinq@fifth.space>
© 2014-2016 Markus Teich <markus.teich@stusta.mhn.de>
© 2015 Jakukyo Friel <weakish@gmail.com>
© 2015 Ben Woolley <tautolog@gmail.com>
© 2015 Greg Reagle <greg.reagle@umbc.edu>
© 2015 GhostAV <ghostav@riseup.net>
© 2015 Ivan Tham <pickfire@riseup.net>
© 2015 Alexander Huemer <alexander.huemer@xx.vu>
© 2015 Michael Stevens <mstevens@etla.org>
© 2015 Felix Janda <felix.janda@posteo.de>
© 2016 Charles Lehner <cel@celehner.com>
© 2016 Dmitry Bogatov <KAction@gnu.org>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
+20 -27
View File
@@ -3,46 +3,39 @@
* by 20h * by 20h
*/ */
#ifndef ARG_H__ #ifndef __ARG_H__
#define ARG_H__ #define __ARG_H__
extern char *argv0; extern char *argv0;
/* use main(int argc, char *argv[]) */ #define USED(x) ((void)(x))
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
argv[0] && argv[0][0] == '-'\ argv[0] && argv[0][1]\
&& argv[0][1];\ && argv[0][0] == '-';\
argc--, argv++) {\ argc--, argv++) {\
char argc_;\ char _argc;\
char **argv_;\ char **_argv;\
int brk_;\
if (argv[0][1] == '-' && argv[0][2] == '\0') {\ if (argv[0][1] == '-' && argv[0][2] == '\0') {\
argv++;\ argv++;\
argc--;\ argc--;\
break;\ break;\
}\ }\
for (brk_ = 0, argv[0]++, argv_ = argv;\ for (argv[0]++, _argv = argv; argv[0][0];\
argv[0][0] && !brk_;\
argv[0]++) {\ argv[0]++) {\
if (argv_ != argv)\ if (_argv != argv)\
break;\ break;\
argc_ = argv[0][0];\ _argc = argv[0][0];\
switch (argc_) switch (_argc)
#define ARGEND }\ #define ARGEND }\
} USED(_argc);\
}\
USED(argv);\
USED(argc);
#define ARGC() argc_ #define EARGF(x) ((argv[1] == NULL)? ((x), abort(), (char *)0) :\
(argc--, argv++, argv[0]))
#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\
((x), abort(), (char *)0) :\
(brk_ = 1, (argv[0][1] != '\0')?\
(&argv[0][1]) :\
(argc--, argv++, argv[0])))
#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\
(char *)0 :\
(brk_ = 1, (argv[0][1] != '\0')?\
(&argv[0][1]) :\
(argc--, argv++, argv[0])))
#endif #endif
+89 -114
View File
@@ -1,68 +1,58 @@
/* modifier 0 means no modifier */ /* modifier 0 means no modifier */
static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */ static char *useragent = "Mozilla/5.0 (X11; U; Unix; en-US) "
static char *fulluseragent = ""; /* Or override the whole user agent string */ "AppleWebKit/537.15 (KHTML, like Gecko) "
"Chrome/24.0.1295.0 Safari/537.15 Surf/"VERSION;
static char *scriptfile = "~/.surf/script.js"; static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/"; static char *styledir = "~/.surf/styles/";
static char *cachedir = "~/.surf/cache/"; static char *cachefolder = "~/.surf/cache/";
static Bool kioskmode = FALSE; /* Ignore shortcuts */
static Bool showindicators = TRUE; /* Show indicators in window title */
static Bool zoomto96dpi = TRUE; /* Zoom pages to always emulate 96dpi */
static Bool runinfullscreen = FALSE; /* Run in fullscreen mode by default */
static guint defaultfontsize = 12; /* Default font size */
static gfloat zoomlevel = 1.0; /* Default zoom level */
/* Soup default features */
static char *cookiefile = "~/.surf/cookies.txt"; static char *cookiefile = "~/.surf/cookies.txt";
static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
* @: accept all except third party */
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
static Bool strictssl = FALSE; /* Refuse untrusted SSL connections */
static time_t sessiontime = 3600;
/* Webkit default features */ /* Webkit default features */
static Parameter defconfig[ParameterLast] = { static Bool enablescrollbars = TRUE;
SETB(AcceleratedCanvas, 1), static Bool enablespatialbrowsing = TRUE;
SETB(CaretBrowsing, 0), static Bool enablediskcache = TRUE;
SETV(CookiePolicies, "@Aa"), static int diskcachebytes = 5 * 1024 * 1024;
SETB(DiskCache, 1), static Bool enableplugins = TRUE;
SETB(DNSPrefetch, 0), static Bool enablescripts = TRUE;
SETI(FontSize, 12), static Bool enableinspector = TRUE;
SETB(FrameFlattening, 0), static Bool enablestyle = TRUE;
SETB(Geolocation, 0), static Bool loadimages = TRUE;
SETB(HideBackground, 0), static Bool hidebackground = FALSE;
SETB(Inspector, 0), static Bool allowgeolocation = TRUE;
SETB(JavaScript, 1),
SETB(KioskMode, 0),
SETB(LoadImages, 1),
SETB(MediaManualPlay, 0),
SETB(Plugins, 1),
SETV(PreferredLanguages, ((char *[]){ NULL })),
SETB(RunInFullscreen, 0),
SETB(ScrollBars, 1),
SETB(ShowIndicators, 1),
SETB(SiteQuirks, 1),
SETB(SpellChecking, 0),
SETV(SpellLanguages, ((char *[]){ "en_US", NULL })),
SETB(StrictSSL, 0),
SETB(Style, 1),
SETF(ZoomLevel, 1.0),
};
static UriParameters uriparams[] = {
{ "(://|\\.)suckless\\.org(/|$)", {
FSETB(JavaScript, 0),
FSETB(Plugins, 0),
}, },
};
static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
WEBKIT_FIND_OPTIONS_WRAP_AROUND;
#define SETPROP(p, q) { \ #define SETPROP(p, q) { \
.v = (const char *[]){ "/bin/sh", "-c", \ .v = (char *[]){ "/bin/sh", "-c", \
"prop=\"`xprop -id $2 $0 " \ "prop=\"`xprop -id $2 $0 " \
"| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \ "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \
"| xargs -0 printf %b | dmenu`\" &&" \ "| xargs -0 printf %b | dmenu`\" &&" \
"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
p, q, winid, NULL \ p, q, winid, NULL \
} \ } \
} }
/* DOWNLOAD(URI, referer) */ /* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \ #define DOWNLOAD(d, r) { \
.v = (const char *[]){ "/bin/sh", "-c", \ .v = (char *[]){ "/bin/sh", "-c", \
"st -e /bin/sh -c \"curl -g -L -J -O --user-agent '$1'" \ "st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
" --referer '$2' -b $3 -c $3 '$0';" \ " --referer '$2' -b $3 -c $3 '$0';" \
" sleep 5;\"", \ " sleep 5;\"", \
d, useragent, r, cookiefile, NULL \ d, useragent, r, cookiefile, NULL \
} \ } \
} }
/* PLUMB(URI) */ /* PLUMB(URI) */
@@ -70,16 +60,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
* "http://" or "https://" should be opened. * "http://" or "https://" should be opened.
*/ */
#define PLUMB(u) {\ #define PLUMB(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \ .v = (char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \ "xdg-open \"$0\"", u, NULL \
} \ } \
}
/* VIDEOPLAY(URI) */
#define VIDEOPLAY(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"mpv --really-quiet \"$0\"", u, NULL \
} \
} }
/* styles */ /* styles */
@@ -100,67 +83,59 @@ static SiteStyle styles[] = {
* edit the CLEANMASK() macro. * edit the CLEANMASK() macro.
*/ */
static Key keys[] = { static Key keys[] = {
/* modifier keyval function arg */ /* modifier keyval function arg Focus */
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") }, { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, { MODKEY, GDK_r, reload, { .b = FALSE } },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
{ 0, GDK_KEY_Escape, stop, { 0 } }, { MODKEY, GDK_p, clipboard, { .b = TRUE } },
{ MODKEY, GDK_KEY_c, stop, { 0 } }, { MODKEY, GDK_y, clipboard, { .b = FALSE } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .b = 1 } }, { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_r, reload, { .b = 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_q, zoom, { .i = 0 } },
{ MODKEY, GDK_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } }, { MODKEY, GDK_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_h, navigate, { .i = -1 } }, { MODKEY, GDK_h, navigate, { .i = -1 } },
/* Currently we have to use scrolling steps that WebKit2GTK+ gives us { MODKEY, GDK_j, scroll_v, { .i = +1 } },
* d: step down, u: step up, r: step right, l:step left { MODKEY, GDK_k, scroll_v, { .i = -1 } },
* D: page down, U: page up */ { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
{ MODKEY, GDK_KEY_j, scroll, { .i = 'd' } }, { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
{ MODKEY, GDK_KEY_k, scroll, { .i = 'u' } }, { MODKEY, GDK_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_KEY_b, scroll, { .i = 'U' } }, { MODKEY, GDK_u, scroll_h, { .i = -1 } },
{ MODKEY, GDK_KEY_space, scroll, { .i = 'D' } },
{ MODKEY, GDK_KEY_i, scroll, { .i = 'r' } },
{ MODKEY, GDK_KEY_u, scroll, { .i = 'l' } },
{ 0, GDK_F11, fullscreen, { 0 } },
{ 0, GDK_Escape, stop, { 0 } },
{ MODKEY, GDK_o, source, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } }, { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } }, { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } }, { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
{ MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_KEY_p, clipboard, { .b = 1 } }, { MODKEY, GDK_n, find, { .b = TRUE } },
{ MODKEY, GDK_KEY_y, clipboard, { .b = 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
{ MODKEY, GDK_KEY_n, find, { .i = +1 } }, { MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } }, { MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
{ 0, GDK_KEY_F11, togglefullscreen, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
}; };
/* button definitions */ /* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */ /* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */
static Button buttons[] = { static Button buttons[] = {
/* target event mask button function argument stop event */ /* click event mask button function argument */
{ OnLink, 0, 2, clicknewwindow, { .b = 0 }, 1 }, { ClkLink, 0, 2, linkopenembed, { 0 } },
{ OnLink, MODKEY, 2, clicknewwindow, { .b = 1 }, 1 }, { ClkLink, MODKEY, 2, linkopen, { 0 } },
{ OnLink, MODKEY, 1, clicknewwindow, { .b = 1 }, 1 }, { ClkLink, MODKEY, 1, linkopen, { 0 } },
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 }, { ClkAny, 0, 8, navigate, { .i = -1 } },
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 }, { ClkAny, 0, 9, navigate, { .i = +1 } },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
}; };
+5 -6
View File
@@ -1,27 +1,26 @@
# surf version # surf version
VERSION = 2.0 VERSION = 0.7
# Customize below to fit your system # Customize below to fit your system
# paths # paths
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
LIBPREFIX = ${PREFIX}/lib/surf
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
GTKINC = `pkg-config --cflags gtk+-3.0 webkit2gtk-4.0` GTKINC = `pkg-config --cflags gtk+-2.0 webkit-1.0`
GTKLIB = `pkg-config --libs gtk+-3.0 webkit2gtk-4.0` GTKLIB = `pkg-config --libs gtk+-2.0 webkit-1.0`
# includes and libs # includes and libs
INCS = -I. -I/usr/include -I${X11INC} ${GTKINC} INCS = -I. -I/usr/include -I${X11INC} ${GTKINC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0
# flags # flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -DWEBEXTDIR=\"${LIBPREFIX}\" -D_DEFAULT_SOURCE CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -s ${LIBS} LDFLAGS = -g ${LIBS}
# Solaris # Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
+7
View File
@@ -283,6 +283,13 @@ string
.TP .TP
.B http_proxy .B http_proxy
If this variable is set and not empty upon startup, surf will use it as the http proxy If this variable is set and not empty upon startup, surf will use it as the http proxy
.TP
.B no_proxy
If both http_proxy is set and no_proxy contain a
.BR comma-separated
list of domain extensions and both is not empty upon startup, proxy will
.BR not
be used for each of the elements in no_proxy.
.SH PLUGINS .SH PLUGINS
For using plugins in surf, first determine your running architecture. Then get For using plugins in surf, first determine your running architecture. Then get
the appropriate plugin for that architecture and copy it to the appropriate plugin for that architecture and copy it to
+1405 -1395
View File
File diff suppressed because it is too large Load Diff