22 Commits

Author SHA1 Message Date
Quentin Rameau 9ba143baba Bump version to 1.8
We're using the new scheme: 1.x is for webkit1, so we jump from previous
0.7 to 1.8
2017-03-28 18:15:47 +02:00
Quentin Rameau 58634c74b3 Add contributors to the LICENSE 2017-03-28 18:15:27 +02:00
Quentin Rameau ab16fa5e7c Simplify proxy toggle 2017-02-08 15:59:55 +01:00
Christoph Lohmann dcabd0239e Add a way to toggle proxy usage while running. 2017-02-06 11:30:44 +01:00
Christoph Lohmann 6c8da4c851 Style change. (Test commit for new update script in hackers@) 2016-08-11 10:41:38 +02:00
Christoph Lohmann 31ec0fb93d Fixing the last patch to the surf style. 2016-06-03 15:14:53 +02:00
Dmitry Bogatov 1308872b8b Check $HOME and home dir of $USER before getpwuid()->pw_dir
getpwnam(3) recommends to use $HOME instead of getpwuid()->pw_dir,
as it allows users to point programs to a different path.

Using getpwuid() also breaks namespaces-related use cases,
like `unshare -r`.

Patch was submitted by Dmitry Bogatov on the Debian bug tracker:
https://bugs.debian.org/825397

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2016-06-03 15:09:08 +02:00
Christoph Lohmann f5e8baad06 Disable globbing in curl. 2016-03-07 14:28:23 +01:00
Christoph Lohmann 842103322c Import the arg.h from st which fixed the oob bug. 2016-02-22 06:47:46 +01:00
Christoph Lohmann 7895fb9c5d Add Code of Conduct. 2016-01-27 16:01:23 +01:00
Christoph Lohmann fd6e80a279 Check for about: too.
Thanks to Claudio Alessi <smoppy@gmail.com>!
2016-01-27 06:44:31 +01:00
Markus Teich 743fa9f3d1 style fixes (mainly whitespace)
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2016-01-18 22:45:04 +01:00
Charles Lehner 0ac6bf5a97 Reload on SIGHUP
This patch makes surf reload its pages when it receives a SIGHUP signal. This makes it easier for shell scripts to trigger surf to reload.

I'm aware of using xdotool to trigger ctrl+r keypresses for reloading [1] but I wasn't able to get that to work in a general way.

I'm sending this here in case surf maintainers and users would like to include this in core - if not I will submit it to the wiki.

Regards,
Charles

[1] http://surf.suckless.org/files/autorefresh

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2016-01-09 21:14:30 +01:00
Christoph Lohmann 3d81a0f0b7 Bump year. 2016-01-01 14:18:19 +01:00
Felix Janda 018a67986d Include fcntl.h for open()
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-12-31 15:18:07 +01:00
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
9 changed files with 1774 additions and 2147 deletions
+85
View File
@@ -0,0 +1,85 @@
Code of Conduct
===============
> ==Phrack Inc.==
> Volume One, Issue 7, Phile 3 of 10
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> The following was written shortly after my arrest...
>
> \/\The Conscience of a Hacker/\/
>
> by
>
> +++The Mentor+++
>
> Written on January 8, 1986
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> Another one got caught today, it's all over the papers. "Teenager
> Arrested in Computer Crime Scandal", "Hacker Arrested after Bank Tampering"...
> Damn kids. They're all alike.
>
> But did you, in your three-piece psychology and 1950's technobrain,
> ever take a look behind the eyes of the hacker? Did you ever wonder what
> made him tick, what forces shaped him, what may have molded him?
> I am a hacker, enter my world...
> Mine is a world that begins with school... I'm smarter than most of
> the other kids, this crap they teach us bores me...
> Damn underachiever. They're all alike.
>
> I'm in junior high or high school. I've listened to teachers explain
> for the fifteenth time how to reduce a fraction. I understand it. "No, Ms.
> Smith, I didn't show my work. I did it in my head..."
> Damn kid. Probably copied it. They're all alike.
>
> I made a discovery today. I found a computer. Wait a second, this is
> cool. It does what I want it to. If it makes a mistake, it's because I
> screwed it up. Not because it doesn't like me...
> Or feels threatened by me...
> Or thinks I'm a smart ass...
> Or doesn't like teaching and shouldn't be here...
> Damn kid. All he does is play games. They're all alike.
>
> And then it happened... a door opened to a world... rushing through
> the phone line like heroin through an addict's veins, an electronic pulse is
> sent out, a refuge from the day-to-day incompetencies is sought... a board is
> found.
> "This is it... this is where I belong..."
> I know everyone here... even if I've never met them, never talked to
> them, may never hear from them again... I know you all...
> Damn kid. Tying up the phone line again. They're all alike...
>
> You bet your ass we're all alike... we've been spoon-fed baby food at
> school when we hungered for steak... the bits of meat that you did let slip
> through were pre-chewed and tasteless. We've been dominated by sadists, or
> ignored by the apathetic. The few that had something to teach found us will-
> ing pupils, but those few are like drops of water in the desert.
>
> This is our world now... the world of the electron and the switch, the
> beauty of the baud. We make use of a service already existing without paying
> for what could be dirt-cheap if it wasn't run by profiteering gluttons, and
> you call us criminals. We explore... and you call us criminals. We seek
> after knowledge... and you call us criminals. We exist without skin color,
> without nationality, without religious bias... and you call us criminals.
> You build atomic bombs, you wage wars, you murder, cheat, and lie to us
> and try to make us believe it's for our own good, yet we're the criminals.
>
> Yes, I am a criminal. My crime is that of curiosity. My crime is
> that of judging people by what they say and think, not what they look like.
> My crime is that of outsmarting you, something that you will never forgive me
> for.
>
> I am a hacker, and this is my manifesto. You may stop this individual,
> but you can't stop us all... after all, we're all alike.
Keep to your sanity, question the world, even this manifest.
Don't follow morals, nothing is right or wrong.
Have fun.
Yours project maintainer on 2016-01-27.
+5 -5
View File
@@ -1,10 +1,10 @@
# 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 commandline and see if there are errors because of nspluginwrapper”
or failed RPCs to them. If that is true, go to ~/.mozilla/plugins and
try removing stale links to plugins not on your system anymore. This
The first suspect for such a behaviour is the plugin handling. Run surf
on the commandline and see if there are errors because of »nspluginwrap
per« or failed RPCs to them. If that is true, go to ~/.mozilla/plugins
and try removing stale links to plugins not on your system anymore. This
will stop surf from trying to load them.
+38 -53
View File
@@ -1,76 +1,61 @@
# surf - simple browser
# See LICENSE file for copyright and license details.
.POSIX:
include config.mk
SRC = surf.c
WSRC = webext-surf.c
OBJ = $(SRC:.c=.o)
WOBJ = $(WSRC:.c=.o)
WLIB = $(WSRC:.c=.so)
OBJ = ${SRC:.c=.o}
all: options surf $(WLIB)
all: options surf
options:
@echo surf build options:
@echo "CC = $(CC)"
@echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)"
@echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
surf: $(OBJ)
$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
.c.o:
@echo CC $<
@${CC} -c ${CFLAGS} $<
$(OBJ) $(WOBJ): config.h common.h config.mk
${OBJ}: config.h config.mk
config.h:
cp config.def.h $@
@echo creating $@ from config.def.h
@cp config.def.h $@
$(OBJ): $(SRC)
$(CC) $(SURFCFLAGS) $(CFLAGS) -c $(SRC)
$(WLIB): $(WOBJ)
$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $? $(WEBEXTLIBS)
$(WOBJ): $(WSRC)
$(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WSRC)
surf: ${OBJ}
@echo CC -o $@
@${CC} -o $@ surf.o ${LDFLAGS}
clean:
rm -f surf $(OBJ)
rm -f $(WLIB) $(WOBJ)
@echo cleaning
@rm -f surf ${OBJ} surf-${VERSION}.tar.gz
distclean: clean
rm -f config.h surf-$(VERSION).tar.gz
dist: distclean
mkdir -p surf-$(VERSION)
cp -R LICENSE Makefile config.mk config.def.h README \
surf-open.sh arg.h TODO.md surf.png \
surf.1 $(SRC) $(CSRC) $(WSRC) surf-$(VERSION)
tar -cf surf-$(VERSION).tar surf-$(VERSION)
gzip surf-$(VERSION).tar
rm -rf surf-$(VERSION)
dist: clean
@echo creating dist tarball
@mkdir -p surf-${VERSION}
@cp -R LICENSE Makefile config.mk config.def.h README \
surf-open.sh arg.h TODO.md surf.png \
surf.1 ${SRC} surf-${VERSION}
@tar -cf surf-${VERSION}.tar surf-${VERSION}
@gzip surf-${VERSION}.tar
@rm -rf surf-${VERSION}
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f surf $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
mkdir -p $(DESTDIR)$(LIBDIR)
cp -f $(WLIB) $(DESTDIR)$(LIBDIR)
for wlib in $(WLIB); do \
chmod 644 $(DESTDIR)$(LIBDIR)/$$wlib; \
done
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f surf ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/surf
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@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:
rm -f $(DESTDIR)$(PREFIX)/bin/surf
rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
for wlib in $(WLIB); do \
rm -f $(DESTDIR)$(LIBDIR)/$$wlib; \
done
- rmdir $(DESTDIR)$(LIBDIR)
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/surf
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/surf.1
.PHONY: all options distclean clean dist install uninstall
.PHONY: all options clean dist install uninstall
-1
View File
@@ -1 +0,0 @@
#define MSGBUFSZ 8
+94 -143
View File
@@ -1,86 +1,58 @@
/* modifier 0 means no modifier */
static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
static char *fulluseragent = ""; /* Or override the whole user agent string */
static char *useragent = "Mozilla/5.0 (X11; U; Unix; en-US) "
"AppleWebKit/537.15 (KHTML, like Gecko) "
"Chrome/24.0.1295.0 Safari/537.15 Surf/"VERSION;
static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
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 *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 */
/* Highest priority value will be used.
* Default parameters are priority 0
* Per-uri parameters are priority 1
* Command parameters are priority 2
*/
static Parameter defconfig[ParameterLast] = {
/* parameter Arg value priority */
[AccessMicrophone] = { { .i = 0 }, },
[AccessWebcam] = { { .i = 0 }, },
[Certificate] = { { .i = 0 }, },
[CaretBrowsing] = { { .i = 0 }, },
[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 Bool enablescrollbars = TRUE;
static Bool enablespatialbrowsing = TRUE;
static Bool enablediskcache = TRUE;
static int diskcachebytes = 5 * 1024 * 1024;
static Bool enableplugins = TRUE;
static Bool enablescripts = TRUE;
static Bool enableinspector = TRUE;
static Bool enablestyle = TRUE;
static Bool loadimages = TRUE;
static Bool hidebackground = FALSE;
static Bool allowgeolocation = TRUE;
static UriParameters uriparams[] = {
{ "(://|\\.)suckless\\.org(/|$)", {
[JavaScript] = { { .i = 0 }, 1 },
}, },
};
/* default window size: width, height */
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 \
} \
#define SETPROP(p, q) { \
.v = (char *[]){ "/bin/sh", "-c", \
"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\"", \
p, q, winid, NULL \
} \
}
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(u, r) { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
" -e \"$3\" \"$4\"; read", \
"surf-download", useragent, cookiefile, r, u, NULL \
} \
#define DOWNLOAD(d, r) { \
.v = (char *[]){ "/bin/sh", "-c", \
"st -e /bin/sh -c \"curl -g -L -J -O --user-agent '$1'" \
" --referer '$2' -b $3 -c $3 '$0';" \
" sleep 5;\"", \
d, useragent, r, cookiefile, NULL \
} \
}
/* PLUMB(URI) */
@@ -88,16 +60,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
* "http://" or "https://" should be opened.
*/
#define PLUMB(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \
} \
}
/* VIDEOPLAY(URI) */
#define VIDEOPLAY(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"mpv --really-quiet \"$0\"", u, NULL \
} \
.v = (char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \
} \
}
/* 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 list.
*/
static SiteSpecific styles[] = {
static SiteStyle styles[] = {
/* regexp file in $styledir */
{ ".*", "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
/* hotkeys */
@@ -127,66 +83,61 @@ static SiteSpecific certs[] = {
* edit the CLEANMASK() macro.
*/
static Key keys[] = {
/* modifier keyval function arg */
{ 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) },
/* modifier keyval function arg Focus */
{ MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
{ MODKEY, GDK_r, reload, { .b = FALSE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY, GDK_p, clipboard, { .b = TRUE } },
{ MODKEY, GDK_y, clipboard, { .b = FALSE } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
{ 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_KEY_h, navigate, { .i = -1 } },
{ MODKEY, GDK_l, navigate, { .i = +1 } },
{ MODKEY, GDK_h, navigate, { .i = -1 } },
/* vertical and horizontal scrolling, in viewport percentage */
{ MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
{ MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
{ MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
{ MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ MODKEY, GDK_j, scroll_v, { .i = +1 } },
{ MODKEY, GDK_k, scroll_v, { .i = -1 } },
{ MODKEY, GDK_b, scroll_v, { .i = -10000 } },
{ MODKEY, GDK_space, scroll_v, { .i = +10000 } },
{ MODKEY, GDK_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_u, scroll_h, { .i = -1 } },
{ 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_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
{ MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
{ MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
{ MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
{ MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ MODKEY, GDK_n, find, { .b = TRUE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
{ MODKEY, GDK_KEY_n, find, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
{ MODKEY, GDK_KEY_t, showcert, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
{ 0, GDK_KEY_F11, togglefullscreen, { 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 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" } },
{ 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_v, toggle, { .v = "enable-plugins" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_y, toggleproxy, { 0 } },
};
/* 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[] = {
/* target event mask button function argument stop event */
{ OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
/* click event mask button function argument */
{ ClkLink, 0, 2, linkopenembed, { 0 } },
{ ClkLink, MODKEY, 2, linkopen, { 0 } },
{ ClkLink, MODKEY, 1, linkopen, { 0 } },
{ ClkAny, 0, 8, navigate, { .i = -1 } },
{ ClkAny, 0, 9, navigate, { .i = +1 } },
};
+17 -19
View File
@@ -1,32 +1,30 @@
# surf version
VERSION = 2.1
VERSION = 1.8
# Customize below to fit your system
# paths
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
LIBPREFIX = $(PREFIX)/lib
LIBDIR = $(LIBPREFIX)/surf
MANPREFIX = ${PREFIX}/share/man
X11INC = `pkg-config --cflags x11`
X11LIB = `pkg-config --libs x11`
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
GTKINC = `pkg-config --cflags gtk+-3.0 gcr-3 webkit2gtk-4.0`
GTKLIB = `pkg-config --libs gtk+-3.0 gcr-3 webkit2gtk-4.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`
GTKINC = `pkg-config --cflags gtk+-2.0 webkit-1.0`
GTKLIB = `pkg-config --libs gtk+-2.0 webkit-1.0`
# includes and libs
INCS = $(X11INC) $(GTKINC)
LIBS = $(X11LIB) $(GTKLIB) -lgthread-2.0
INCS = -I. -I/usr/include -I${X11INC} ${GTKINC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0
# flags
CPPFLAGS = -DVERSION=\"$(VERSION)\" -DGCR_API_SUBJECT_TO_CHANGE \
-DLIBPREFIX=\"$(LIBPREFIX)\" -DWEBEXTDIR=\"$(LIBDIR)\" \
-D_DEFAULT_SOURCE
SURFCFLAGS = -fPIC $(INCS) $(CPPFLAGS)
WEBEXTCFLAGS = -fPIC $(WEBEXTINC)
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -g ${LIBS}
# compiler
#CC = c99
# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
# compiler and linker
CC = cc
+70 -61
View File
@@ -3,15 +3,15 @@
surf \- simple webkit-based browser
.SH SYNOPSIS
.B surf
.RB [-bBdDfFgGiIkKmMnNpPsStTvwxX]
.RB [-bBdDfFgGiIkKmMnNpPsSvx]
.RB [-a\ cookiepolicies]
.RB [-c\ cookiefile]
.RB [-C\ stylefile]
.RB [-e\ xid]
.RB [-r\ scriptfile]
.RB [-t\ stylefile]
.RB [-u\ useragent]
.RB [-z\ zoomlevel]
.RB [URI]
.RB "URI"
.SH DESCRIPTION
surf is a simple Web browser based on WebKit/GTK+. It is able
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
.B \-a cookiepolicies
Define the order of
.I cookie policies\fR.
The default is "@Aa" but could be
.I cookie policies.
The default is "Aa@" but could be
redefined in the
.IR config.h ,
.I config.h,
with "A" meaning to
accept all cookies, "a" to deny all cookies and "@", which tells surf to
accept no third party cookies.
.TP
.B \-b
Disable Scrollbars.
Disable Scrollbars
.TP
.B \-B
Enable Scrollbars.
Enable Scrollbars
.TP
.B \-c cookiefile
.B \-c cookiefile
Specify the
.I cookiefile
to use.
.TP
.B \-C stylefile
Specify the user
.IR stylefile .
This does disable the site-specific styles.
.TP
.B \-d
Disable the disk cache.
.TP
@@ -53,7 +48,7 @@ Enable the disk cache.
.TP
.B \-e xid
Reparents to window specified by
.IR xid .
.I xid.
.TP
.B \-f
Start surf in windowed mode (not fullscreen).
@@ -68,16 +63,16 @@ Disable giving the geolocation to websites.
Enable giving the geolocation to websites.
.TP
.B \-i
Disable Images.
Disable Images
.TP
.B \-I
Enable Images.
Enable Images
.TP
.B \-k
Disable kiosk mode (disable key strokes and right click).
Disable kiosk mode (disable key strokes and right click)
.TP
.B \-K
Enable kiosk mode (disable key strokes and right click).
Enable kiosk mode (disable key strokes and right click)
.TP
.B \-m
Disable application of user style sheets.
@@ -91,23 +86,28 @@ Disable the Web Inspector (Developer Tools).
.B \-N
Enable the Web Inspector (Developer Tools).
.TP
.B \-r scriptfile
.B \-p
Disable Plugins
.TP
.B \-P
Enable Plugins
.TP
.B \-r scriptfile
Specify the user
.IR scriptfile .
.I scriptfile.
.TP
.B \-s
Disable Javascript.
Disable Javascript
.TP
.B \-S
Enable Javascript.
Enable Javascript
.TP
.B \-t
Disable strict TLS check.
.B \-t stylefile
Specify the user
.I stylefile.
This does disable the site-specific styles.
.TP
.B \-T
Enable strict TLS check.
.TP
.B \-u useragent
.B \-u useragent
Specify the
.I useragent
which surf should use.
@@ -115,21 +115,16 @@ which surf should use.
.B \-v
Prints version information to standard output, then exits.
.TP
.B \-w
.B \-x
Prints xid to standard output. This can be used to script the browser in for
example
.BR xdotool(1) .
.BR xdotool(1).
.TP
.B -x
Disable custom certificates.
.TP
.B -X
Enable custom certificates.
.TP
.B \-z zoomlevel
.B \-z zoomlevel
Specify the
.I zoomlevel
which surf should use.
.BR xprop(1).
.SH USAGE
.B Escape
Stops loading current page or stops download.
@@ -162,10 +157,10 @@ Scroll horizontally to the left.
Zooms page in.
.TP
.B Ctrl\-Shift\-j or Ctrl\--
Zooms page out.
Zooms page out
.TP
.B Ctrl\-Shift\-q
Resets Zoom.
Resets Zoom
.TP
.B Ctrl\-f and Ctrl\-/
Opens the search-bar.
@@ -194,12 +189,12 @@ Reloads the website without using the cache.
.B Ctrl\-y
Copies current URI to primary selection.
.TP
.B Ctrl\-t
Display the current TLS certificate in a popup window.
.B Ctrl\-o
Show the sourcecode of the current page.
.TP
.B Ctrl\-Shift\-a
Toggle through the the
.I cookie policies\fR.
.I cookie policies.
This will not reload the page.
.TP
.B Ctrl\-Shift\-b
@@ -213,7 +208,7 @@ Toggle auto-loading of images. This will reload the page.
.TP
.B Ctrl\-Shift\-m
Toggle if the
.I stylefile
.I stylefile
file should be loaded. This will reload the page.
.TP
.B Ctrl\-Shift\-o
@@ -222,8 +217,12 @@ Open the Web Inspector (Developer Tools) window for the current page.
.B Ctrl\-Shift\-s
Toggle script execution. This will reload the page.
.TP
.B Ctrl\-Shift\-t
Toggle strict TLS check. This will reload the page.
.B Ctrl\-Shift\-v
Toggle the enabling of plugins on that surf instance. This will reload the
page.
.TP
.B Ctrl\-Shift\-y
Toggle if a proxy should be used (if one is set in the environment).
.TP
.B F11
Toggle fullscreen mode.
@@ -255,17 +254,11 @@ images
.B s S
scripts
.TP
.B v V
plugins
.TP
.B m M
styles
.TP
.B f F
frame flattening
.TP
.B x X
custom certificates
.TP
.B t T
strict TLS
.SH INDICATORS OF WEB PAGE
The second part of the indicators specifies modes of the web page itself.
.SS First character: encryption
@@ -274,7 +267,7 @@ The second part of the indicators specifies modes of the web page itself.
unencrypted
.TP
.B T
encrypted (TLS)
encrypted (SSL)
.TP
.B U
attempted encryption but failed
@@ -289,17 +282,33 @@ using proxy
.B SURF_USERAGENT
If this variable is set upon startup, surf will use it as the
.I useragent
string.
string
.TP
.B http_proxy
If this variable is set and not empty upon startup, surf will use it as the http proxy.
.SH SIGNALS
Surf will reload the current page on
.BR SIGHUP .
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
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
.BR dmenu(1),
.BR xprop(1),
.BR tabbed(1),
.BR nspluginwrapper(1),
.BR xdotool(1)
.SH BUGS
Please report them!
+1465 -1759
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);
}