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
10 changed files with 1666 additions and 2222 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
# Frequently Asked Questions # Frequently Asked Questions
## Surf is starting up slowly. What might be causing this? ## Surf is starting up slowly. What might happen?
The first suspect for such behaviour is the plugin handling. Run surf on The first suspect for such a behaviour is the plugin handling. Run surf
the commandline and see if there are errors because of nspluginwrapper” on the commandline and see if there are errors because of »nspluginwrap
or failed RPCs to them. If that is true, go to ~/.mozilla/plugins and per« or failed RPCs to them. If that is true, go to ~/.mozilla/plugins
try removing stale links to plugins not on your system anymore. This and try removing stale links to plugins not on your system anymore. This
will stop surf from trying to load them. will stop surf from trying to load them.
+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"),
+38 -53
View File
@@ -1,76 +1,61 @@
# surf - simple browser # surf - simple browser
# See LICENSE file for copyright and license details. # See LICENSE file for copyright and license details.
.POSIX:
include config.mk include config.mk
SRC = surf.c SRC = surf.c
WSRC = webext-surf.c OBJ = ${SRC:.c=.o}
OBJ = $(SRC:.c=.o)
WOBJ = $(WSRC:.c=.o)
WLIB = $(WSRC:.c=.so)
all: options surf $(WLIB) all: options surf
options: options:
@echo surf build options: @echo surf build options:
@echo "CC = $(CC)" @echo "CFLAGS = ${CFLAGS}"
@echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)" @echo "LDFLAGS = ${LDFLAGS}"
@echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)" @echo "CC = ${CC}"
@echo "LDFLAGS = $(LDFLAGS)"
surf: $(OBJ) .c.o:
$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) @echo CC $<
@${CC} -c ${CFLAGS} $<
$(OBJ) $(WOBJ): config.h common.h config.mk ${OBJ}: config.h config.mk
config.h: config.h:
cp config.def.h $@ @echo creating $@ from config.def.h
@cp config.def.h $@
$(OBJ): $(SRC) surf: ${OBJ}
$(CC) $(SURFCFLAGS) $(CFLAGS) -c $(SRC) @echo CC -o $@
@${CC} -o $@ surf.o ${LDFLAGS}
$(WLIB): $(WOBJ)
$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $? $(WEBEXTLIBS)
$(WOBJ): $(WSRC)
$(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WSRC)
clean: clean:
rm -f surf $(OBJ) @echo cleaning
rm -f $(WLIB) $(WOBJ) @rm -f surf ${OBJ} surf-${VERSION}.tar.gz
distclean: clean dist: clean
rm -f config.h surf-$(VERSION).tar.gz @echo creating dist tarball
@mkdir -p surf-${VERSION}
dist: distclean @cp -R LICENSE Makefile config.mk config.def.h README \
mkdir -p surf-$(VERSION) surf-open.sh arg.h TODO.md surf.png \
cp -R LICENSE Makefile config.mk config.def.h README \ surf.1 ${SRC} surf-${VERSION}
surf-open.sh arg.h TODO.md surf.png \ @tar -cf surf-${VERSION}.tar surf-${VERSION}
surf.1 $(SRC) $(CSRC) $(WSRC) surf-$(VERSION) @gzip surf-${VERSION}.tar
tar -cf surf-$(VERSION).tar surf-$(VERSION) @rm -rf surf-${VERSION}
gzip surf-$(VERSION).tar
rm -rf surf-$(VERSION)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin @echo installing executable file to ${DESTDIR}${PREFIX}/bin
cp -f surf $(DESTDIR)$(PREFIX)/bin @mkdir -p ${DESTDIR}${PREFIX}/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/surf @cp -f surf ${DESTDIR}${PREFIX}/bin
mkdir -p $(DESTDIR)$(LIBDIR) @chmod 755 ${DESTDIR}${PREFIX}/bin/surf
cp -f $(WLIB) $(DESTDIR)$(LIBDIR) @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
for wlib in $(WLIB); do \ @mkdir -p ${DESTDIR}${MANPREFIX}/man1
chmod 644 $(DESTDIR)$(LIBDIR)/$$wlib; \ @sed "s/VERSION/${VERSION}/g" < surf.1 > ${DESTDIR}${MANPREFIX}/man1/surf.1
done @chmod 644 ${DESTDIR}${MANPREFIX}/man1/surf.1
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/surf @echo removing executable file from ${DESTDIR}${PREFIX}/bin
rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1 @rm -f ${DESTDIR}${PREFIX}/bin/surf
for wlib in $(WLIB); do \ @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
rm -f $(DESTDIR)$(LIBDIR)/$$wlib; \ @rm -f ${DESTDIR}${MANPREFIX}/man1/surf.1
done
- rmdir $(DESTDIR)$(LIBDIR)
.PHONY: all options distclean clean dist install uninstall .PHONY: all options clean dist install uninstall
+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
-1
View File
@@ -1 +0,0 @@
#define MSGBUFSZ 8
+92 -143
View File
@@ -1,86 +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 *certdir = "~/.surf/certificates/"; static char *cachefolder = "~/.surf/cache/";
static char *cachedir = "~/.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 */
/* Highest priority value will be used. static Bool enablescrollbars = TRUE;
* Default parameters are priority 0 static Bool enablespatialbrowsing = TRUE;
* Per-uri parameters are priority 1 static Bool enablediskcache = TRUE;
* Command parameters are priority 2 static int diskcachebytes = 5 * 1024 * 1024;
*/ static Bool enableplugins = TRUE;
static Parameter defconfig[ParameterLast] = { static Bool enablescripts = TRUE;
/* parameter Arg value priority */ static Bool enableinspector = TRUE;
[AccessMicrophone] = { { .i = 0 }, }, static Bool enablestyle = TRUE;
[AccessWebcam] = { { .i = 0 }, }, static Bool loadimages = TRUE;
[Certificate] = { { .i = 0 }, }, static Bool hidebackground = FALSE;
[CaretBrowsing] = { { .i = 0 }, }, static Bool allowgeolocation = TRUE;
[CookiePolicies] = { { .v = "@Aa" }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
[Ephemeral] = { { .i = 0 }, },
[FileURLsCrossAccess] = { { .i = 0 }, },
[FontSize] = { { .i = 12 }, },
[FrameFlattening] = { { .i = 0 }, },
[Geolocation] = { { .i = 0 }, },
[HideBackground] = { { .i = 0 }, },
[Inspector] = { { .i = 0 }, },
[Java] = { { .i = 1 }, },
[JavaScript] = { { .i = 1 }, },
[KioskMode] = { { .i = 0 }, },
[LoadImages] = { { .i = 1 }, },
[MediaManualPlay] = { { .i = 1 }, },
[PreferredLanguages] = { { .v = (char *[]){ NULL } }, },
[RunInFullscreen] = { { .i = 0 }, },
[ScrollBars] = { { .i = 1 }, },
[ShowIndicators] = { { .i = 1 }, },
[SiteQuirks] = { { .i = 1 }, },
[SmoothScrolling] = { { .i = 0 }, },
[SpellChecking] = { { .i = 0 }, },
[SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, },
[StrictTLS] = { { .i = 1 }, },
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
};
static UriParameters uriparams[] = { #define SETPROP(p, q) { \
{ "(://|\\.)suckless\\.org(/|$)", { .v = (char *[]){ "/bin/sh", "-c", \
[JavaScript] = { { .i = 0 }, 1 }, "prop=\"`xprop -id $2 $0 " \
}, }, "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \
}; "| xargs -0 printf %b | dmenu`\" &&" \
"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
/* default window size: width, height */ p, q, winid, NULL \
static int winsize[] = { 800, 600 }; } \
static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
WEBKIT_FIND_OPTIONS_WRAP_AROUND;
#define PROMPT_GO "Go:"
#define PROMPT_FIND "Find:"
/* 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/\")\" " \
"| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
"surf-setprop", winid, r, s, p, NULL \
} \
} }
/* DOWNLOAD(URI, referer) */ /* DOWNLOAD(URI, referer) */
#define DOWNLOAD(u, r) { \ #define DOWNLOAD(d, r) { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\ .v = (char *[]){ "/bin/sh", "-c", \
"curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \ "st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
" -e \"$3\" \"$4\"; read", \ " --referer '$2' -b $3 -c $3 '$0';" \
"surf-download", useragent, cookiefile, r, u, NULL \ " sleep 5;\"", \
} \ d, useragent, r, cookiefile, NULL \
} \
} }
/* PLUMB(URI) */ /* PLUMB(URI) */
@@ -88,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 */
@@ -105,20 +70,11 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
* The iteration will stop at the first match, beginning at the beginning of * The iteration will stop at the first match, beginning at the beginning of
* the list. * the list.
*/ */
static SiteSpecific styles[] = { static SiteStyle styles[] = {
/* regexp file in $styledir */ /* regexp file in $styledir */
{ ".*", "default.css" }, { ".*", "default.css" },
}; };
/* certificates */
/*
* Provide custom certificate for urls
*/
static SiteSpecific certs[] = {
/* regexp file in $certdir */
{ "://suckless\\.org/", "suckless.org.crt" },
};
#define MODKEY GDK_CONTROL_MASK #define MODKEY GDK_CONTROL_MASK
/* hotkeys */ /* hotkeys */
@@ -127,66 +83,59 @@ static SiteSpecific certs[] = {
* 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", PROMPT_GO) }, { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) }, { MODKEY, GDK_r, reload, { .b = FALSE } },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_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, { .i = 1 } }, { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 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 } },
/* vertical and horizontal scrolling, in viewport percentage */ { MODKEY, GDK_j, scroll_v, { .i = +1 } },
{ MODKEY, GDK_KEY_j, scrollv, { .i = +10 } }, { MODKEY, GDK_k, scroll_v, { .i = -1 } },
{ MODKEY, GDK_KEY_k, scrollv, { .i = -10 } }, { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
{ MODKEY, GDK_KEY_space, scrollv, { .i = +50 } }, { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
{ MODKEY, GDK_KEY_b, scrollv, { .i = -50 } }, { MODKEY, GDK_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } }, { MODKEY, GDK_u, scroll_h, { .i = -1 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ 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, { .i = 1 } }, { MODKEY, GDK_n, find, { .b = TRUE } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 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_KEY_t, showcert, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
{ 0, GDK_KEY_F11, togglefullscreen, { 0 } }, { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 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_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ 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, { .i = 0 }, 1 }, { ClkLink, 0, 2, linkopenembed, { 0 } },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 }, { ClkLink, MODKEY, 2, linkopen, { 0 } },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 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 },
}; };
+17 -19
View File
@@ -1,32 +1,30 @@
# surf version # surf version
VERSION = 2.1 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
LIBDIR = $(LIBPREFIX)/surf
X11INC = `pkg-config --cflags x11` X11INC = /usr/X11R6/include
X11LIB = `pkg-config --libs x11` X11LIB = /usr/X11R6/lib
GTKINC = `pkg-config --cflags gtk+-3.0 gcr-3 webkit2gtk-4.0` GTKINC = `pkg-config --cflags gtk+-2.0 webkit-1.0`
GTKLIB = `pkg-config --libs gtk+-3.0 gcr-3 webkit2gtk-4.0` GTKLIB = `pkg-config --libs gtk+-2.0 webkit-1.0`
WEBEXTINC = `pkg-config --cflags webkit2gtk-4.0 webkit2gtk-web-extension-4.0 gio-2.0`
WEBEXTLIBS = `pkg-config --libs webkit2gtk-4.0 webkit2gtk-web-extension-4.0 gio-2.0`
# includes and libs # includes and libs
INCS = $(X11INC) $(GTKINC) INCS = -I. -I/usr/include -I${X11INC} ${GTKINC}
LIBS = $(X11LIB) $(GTKLIB) -lgthread-2.0 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0
# flags # flags
CPPFLAGS = -DVERSION=\"$(VERSION)\" -DGCR_API_SUBJECT_TO_CHANGE \ CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
-DLIBPREFIX=\"$(LIBPREFIX)\" -DWEBEXTDIR=\"$(LIBDIR)\" \ CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
-D_DEFAULT_SOURCE LDFLAGS = -g ${LIBS}
SURFCFLAGS = -fPIC $(INCS) $(CPPFLAGS)
WEBEXTCFLAGS = -fPIC $(WEBEXTINC)
# compiler # Solaris
#CC = c99 #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
# compiler and linker
CC = cc
+62 -56
View File
@@ -3,15 +3,15 @@
surf \- simple webkit-based browser surf \- simple webkit-based browser
.SH SYNOPSIS .SH SYNOPSIS
.B surf .B surf
.RB [-bBdDfFgGiIkKmMnNpPsStTvwxX] .RB [-bBdDfFgGiIkKmMnNpPsSvx]
.RB [-a\ cookiepolicies] .RB [-a\ cookiepolicies]
.RB [-c\ cookiefile] .RB [-c\ cookiefile]
.RB [-C\ stylefile]
.RB [-e\ xid] .RB [-e\ xid]
.RB [-r\ scriptfile] .RB [-r\ scriptfile]
.RB [-t\ stylefile]
.RB [-u\ useragent] .RB [-u\ useragent]
.RB [-z\ zoomlevel] .RB [-z\ zoomlevel]
.RB [URI] .RB "URI"
.SH DESCRIPTION .SH DESCRIPTION
surf is a simple Web browser based on WebKit/GTK+. It is able surf is a simple Web browser based on WebKit/GTK+. It is able
to display websites and follow links. It supports the XEmbed protocol to display websites and follow links. It supports the XEmbed protocol
@@ -21,30 +21,25 @@ one can point surf to another URI by setting its XProperties.
.TP .TP
.B \-a cookiepolicies .B \-a cookiepolicies
Define the order of Define the order of
.I cookie policies\fR. .I cookie policies.
The default is "@Aa" but could be The default is "Aa@" but could be
redefined in the redefined in the
.IR config.h , .I config.h,
with "A" meaning to with "A" meaning to
accept all cookies, "a" to deny all cookies and "@", which tells surf to accept all cookies, "a" to deny all cookies and "@", which tells surf to
accept no third party cookies. accept no third party cookies.
.TP .TP
.B \-b .B \-b
Disable Scrollbars. Disable Scrollbars
.TP .TP
.B \-B .B \-B
Enable Scrollbars. Enable Scrollbars
.TP .TP
.B \-c cookiefile .B \-c cookiefile
Specify the Specify the
.I cookiefile .I cookiefile
to use. to use.
.TP .TP
.B \-C stylefile
Specify the user
.IR stylefile .
This does disable the site-specific styles.
.TP
.B \-d .B \-d
Disable the disk cache. Disable the disk cache.
.TP .TP
@@ -53,7 +48,7 @@ Enable the disk cache.
.TP .TP
.B \-e xid .B \-e xid
Reparents to window specified by Reparents to window specified by
.IR xid . .I xid.
.TP .TP
.B \-f .B \-f
Start surf in windowed mode (not fullscreen). Start surf in windowed mode (not fullscreen).
@@ -68,16 +63,16 @@ Disable giving the geolocation to websites.
Enable giving the geolocation to websites. Enable giving the geolocation to websites.
.TP .TP
.B \-i .B \-i
Disable Images. Disable Images
.TP .TP
.B \-I .B \-I
Enable Images. Enable Images
.TP .TP
.B \-k .B \-k
Disable kiosk mode (disable key strokes and right click). Disable kiosk mode (disable key strokes and right click)
.TP .TP
.B \-K .B \-K
Enable kiosk mode (disable key strokes and right click). Enable kiosk mode (disable key strokes and right click)
.TP .TP
.B \-m .B \-m
Disable application of user style sheets. Disable application of user style sheets.
@@ -91,21 +86,26 @@ Disable the Web Inspector (Developer Tools).
.B \-N .B \-N
Enable the Web Inspector (Developer Tools). Enable the Web Inspector (Developer Tools).
.TP .TP
.B \-p
Disable Plugins
.TP
.B \-P
Enable Plugins
.TP
.B \-r scriptfile .B \-r scriptfile
Specify the user Specify the user
.IR scriptfile . .I scriptfile.
.TP .TP
.B \-s .B \-s
Disable Javascript. Disable Javascript
.TP .TP
.B \-S .B \-S
Enable Javascript. Enable Javascript
.TP .TP
.B \-t .B \-t stylefile
Disable strict TLS check. Specify the user
.TP .I stylefile.
.B \-T This does disable the site-specific styles.
Enable strict TLS check.
.TP .TP
.B \-u useragent .B \-u useragent
Specify the Specify the
@@ -115,21 +115,16 @@ which surf should use.
.B \-v .B \-v
Prints version information to standard output, then exits. Prints version information to standard output, then exits.
.TP .TP
.B \-w .B \-x
Prints xid to standard output. This can be used to script the browser in for Prints xid to standard output. This can be used to script the browser in for
example example
.BR xdotool(1) . .BR xdotool(1).
.TP
.B -x
Disable custom certificates.
.TP
.B -X
Enable custom certificates.
.TP .TP
.B \-z zoomlevel .B \-z zoomlevel
Specify the Specify the
.I zoomlevel .I zoomlevel
which surf should use. which surf should use.
.BR xprop(1).
.SH USAGE .SH USAGE
.B Escape .B Escape
Stops loading current page or stops download. Stops loading current page or stops download.
@@ -162,10 +157,10 @@ Scroll horizontally to the left.
Zooms page in. Zooms page in.
.TP .TP
.B Ctrl\-Shift\-j or Ctrl\-- .B Ctrl\-Shift\-j or Ctrl\--
Zooms page out. Zooms page out
.TP .TP
.B Ctrl\-Shift\-q .B Ctrl\-Shift\-q
Resets Zoom. Resets Zoom
.TP .TP
.B Ctrl\-f and Ctrl\-/ .B Ctrl\-f and Ctrl\-/
Opens the search-bar. Opens the search-bar.
@@ -194,12 +189,12 @@ Reloads the website without using the cache.
.B Ctrl\-y .B Ctrl\-y
Copies current URI to primary selection. Copies current URI to primary selection.
.TP .TP
.B Ctrl\-t .B Ctrl\-o
Display the current TLS certificate in a popup window. Show the sourcecode of the current page.
.TP .TP
.B Ctrl\-Shift\-a .B Ctrl\-Shift\-a
Toggle through the the Toggle through the the
.I cookie policies\fR. .I cookie policies.
This will not reload the page. This will not reload the page.
.TP .TP
.B Ctrl\-Shift\-b .B Ctrl\-Shift\-b
@@ -222,8 +217,9 @@ Open the Web Inspector (Developer Tools) window for the current page.
.B Ctrl\-Shift\-s .B Ctrl\-Shift\-s
Toggle script execution. This will reload the page. Toggle script execution. This will reload the page.
.TP .TP
.B Ctrl\-Shift\-t .B Ctrl\-Shift\-v
Toggle strict TLS check. This will reload the page. Toggle the enabling of plugins on that surf instance. This will reload the
page.
.TP .TP
.B F11 .B F11
Toggle fullscreen mode. Toggle fullscreen mode.
@@ -255,17 +251,11 @@ images
.B s S .B s S
scripts scripts
.TP .TP
.B v V
plugins
.TP
.B m M .B m M
styles styles
.TP
.B f F
frame flattening
.TP
.B x X
custom certificates
.TP
.B t T
strict TLS
.SH INDICATORS OF WEB PAGE .SH INDICATORS OF WEB PAGE
The second part of the indicators specifies modes of the web page itself. The second part of the indicators specifies modes of the web page itself.
.SS First character: encryption .SS First character: encryption
@@ -274,7 +264,7 @@ The second part of the indicators specifies modes of the web page itself.
unencrypted unencrypted
.TP .TP
.B T .B T
encrypted (TLS) encrypted (SSL)
.TP .TP
.B U .B U
attempted encryption but failed attempted encryption but failed
@@ -289,17 +279,33 @@ using proxy
.B SURF_USERAGENT .B SURF_USERAGENT
If this variable is set upon startup, surf will use it as the If this variable is set upon startup, surf will use it as the
.I useragent .I useragent
string. 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
.SH SIGNALS .TP
Surf will reload the current page on .B no_proxy
.BR SIGHUP . 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
For using plugins in surf, first determine your running architecture. Then get
the appropriate plugin for that architecture and copy it to
.BR /usr/lib/browser-plugins
or
.BR /usr/lib64/browser-plugins.
Surf should load them automatically.
.BR
If you want to use a 32bit plugin on a 64bit system,
.BR nspluginwrapper(1)
will help you.
.SH SEE ALSO .SH SEE ALSO
.BR dmenu(1), .BR dmenu(1),
.BR xprop(1), .BR xprop(1),
.BR tabbed(1), .BR tabbed(1),
.BR nspluginwrapper(1),
.BR xdotool(1) .BR xdotool(1)
.SH BUGS .SH BUGS
Please report them! Please report them!
+1424 -1780
View File
File diff suppressed because it is too large Load Diff
-106
View File
@@ -1,106 +0,0 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <gio/gio.h>
#include <webkit2/webkit-web-extension.h>
#include <webkitdom/webkitdom.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
#include "common.h"
#define LENGTH(x) (sizeof(x) / sizeof(x[0]))
static WebKitWebExtension *webext;
static int sock;
static void
msgsurf(guint64 pageid, const char *s)
{
static char msg[MSGBUFSZ];
size_t sln = strlen(s);
int ret;
if ((ret = snprintf(msg, sizeof(msg), "%c%s", pageid, s))
>= sizeof(msg)) {
fprintf(stderr, "webext: msg: message too long: %d\n", ret);
return;
}
if (send(sock, msg, ret, 0) < 0)
fprintf(stderr, "webext: error sending: %s\n", msg+1);
}
static gboolean
readsock(GIOChannel *s, GIOCondition c, gpointer unused)
{
static char js[48], msg[MSGBUFSZ];
WebKitWebPage *page;
JSCContext *jsc;
GError *gerr = NULL;
gsize msgsz;
if (g_io_channel_read_chars(s, msg, sizeof(msg), &msgsz, &gerr) !=
G_IO_STATUS_NORMAL) {
if (gerr) {
fprintf(stderr, "webext: error reading socket: %s\n",
gerr->message);
g_error_free(gerr);
}
return TRUE;
}
if (msgsz < 2) {
fprintf(stderr, "webext: readsock: message too short: %d\n",
msgsz);
return TRUE;
}
if (!(page = webkit_web_extension_get_page(webext, msg[0])))
return TRUE;
jsc = webkit_frame_get_js_context(webkit_web_page_get_main_frame(page));
switch (msg[1]) {
case 'h':
if (msgsz != 3)
return TRUE;
snprintf(js, sizeof(js),
"window.scrollBy(window.innerWidth/100*%d,0);",
msg[2]);
jsc_context_evaluate(jsc, js, -1);
break;
case 'v':
if (msgsz != 3)
return TRUE;
snprintf(js, sizeof(js),
"window.scrollBy(0,window.innerHeight/100*%d);",
msg[2]);
jsc_context_evaluate(jsc, js, -1);
break;
}
return TRUE;
}
G_MODULE_EXPORT void
webkit_web_extension_initialize_with_user_data(WebKitWebExtension *e,
const GVariant *gv)
{
GIOChannel *gchansock;
webext = e;
g_variant_get(gv, "i", &sock);
gchansock = g_io_channel_unix_new(sock);
g_io_channel_set_encoding(gchansock, NULL, NULL);
g_io_channel_set_flags(gchansock, g_io_channel_get_flags(gchansock)
| G_IO_FLAG_NONBLOCK, NULL);
g_io_channel_set_close_on_unref(gchansock, TRUE);
g_io_add_watch(gchansock, G_IO_IN, readsock, NULL);
}