23 Commits

Author SHA1 Message Date
Quentin Rameau 1c640fe0f5 Bump year in program 2017-04-24 11:22:27 +02:00
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 # 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.
+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
-1
View File
@@ -1 +0,0 @@
#define MSGBUFSZ 8
+94 -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 -g -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,61 @@ 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_y, toggleproxy, { 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 = 1.8
# 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
+65 -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,12 @@ 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
.B Ctrl\-Shift\-y
Toggle if a proxy should be used (if one is set in the environment).
.TP .TP
.B F11 .B F11
Toggle fullscreen mode. Toggle fullscreen mode.
@@ -255,17 +254,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 +267,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 +282,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!
+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);
}