Switch from surf to firefox

This commit is contained in:
2024-06-12 23:18:00 +01:00
parent 46f8ff2a56
commit c19ad48dc4
21 changed files with 5 additions and 3647 deletions

View File

@@ -31,8 +31,6 @@ static const Rule rules[] = {
*/
/* class instance title tags mask isfloating CenterThisWindow? monitor */
{ "st", NULL, NULL, 0, 0, 1, -1 },
{ "Gimp", NULL, NULL, 0, 1, 0, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
};
/* layout(s) */
@@ -70,7 +68,7 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
static const char *termcmd[] = { "tabbed", "-c", "-r", "2", "st", "-w", "''", NULL };
static const char *slockcmd[] = { "slock", NULL };
static const char *screenshotcmd[] = { "scrot", "--select", "--line", "mode=edge", NULL };
static const char *surfcmd[] = { "tabbed", "-c", "-r", "2", "surf", "-e", "ID", ".homepage/index.html" };
static const char *webcmd[] = { "firefox", "--new-window", "/home/trude/.homepage/index.html" };
static const Key keys[] = {
/* Volume keys support */
@@ -83,7 +81,7 @@ static const Key keys[] = {
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } },
{ MODKEY|ShiftMask, XK_s, spawn, {.v = screenshotcmd } },
{ MODKEY, XK_w, spawn, {.v = surfcmd } },
{ MODKEY, XK_w, spawn, {.v = webcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },

View File

@@ -31,8 +31,6 @@ static const Rule rules[] = {
*/
/* class instance title tags mask isfloating CenterThisWindow? monitor */
{ "st", NULL, NULL, 0, 0, 1, -1 },
{ "Gimp", NULL, NULL, 0, 1, 0, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
};
/* layout(s) */
@@ -70,7 +68,7 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
static const char *termcmd[] = { "tabbed", "-c", "-r", "2", "st", "-w", "''", NULL };
static const char *slockcmd[] = { "slock", NULL };
static const char *screenshotcmd[] = { "scrot", "--select", "--line", "mode=edge", NULL };
static const char *surfcmd[] = { "tabbed", "-c", "-r", "2", "surf", "-e", "ID", ".homepage/index.html" };
static const char *webcmd[] = { "firefox", "--new-window", "/home/trude/.homepage/index.html" };
static const Key keys[] = {
/* Volume keys support */
@@ -83,7 +81,7 @@ static const Key keys[] = {
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } },
{ MODKEY|ShiftMask, XK_s, spawn, {.v = screenshotcmd } },
{ MODKEY, XK_w, spawn, {.v = surfcmd } },
{ MODKEY, XK_w, spawn, {.v = webcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },

Binary file not shown.

View File

@@ -1,48 +0,0 @@
MIT/X Consortium License
© 2009-2010 Enno Boland <tox@s01.de>
© 2009 Thomas Menari <spaceinvader@chaotika.org>
© 2009 Simon Rozet <simon@rozet.name>
© 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
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -1,76 +0,0 @@
# 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)
all: options surf $(WLIB)
options:
@echo surf build options:
@echo "CC = $(CC)"
@echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)"
@echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
surf: $(OBJ)
$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
$(OBJ) $(WOBJ): config.h common.h config.mk
config.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)
clean:
rm -f surf $(OBJ)
rm -f $(WLIB) $(WOBJ)
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 common.h $(SRC) $(WSRC) 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
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)
.PHONY: all options distclean clean dist install uninstall

View File

@@ -1,40 +0,0 @@
surf - simple webkit-based browser
==================================
surf is a simple Web browser based on WebKit/GTK+.
Requirements
------------
In order to build surf you need GTK+ and Webkit/GTK+ header files.
In order to use the functionality of the url-bar, also install dmenu[0].
Installation
------------
Edit config.mk to match your local setup (surf is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install surf (if
necessary as root):
make clean install
Running surf
------------
run
surf [URI]
See the manpage for further options.
Running surf in tabbed
----------------------
For running surf in tabbed[1] there is a script included in the distribution,
which is run like this:
surf-open.sh [URI]
Further invocations of the script will run surf with the specified URI in this
instance of tabbed.
[0] http://tools.suckless.org/dmenu
[1] http://tools.suckless.org/tabbed

View File

@@ -1,10 +0,0 @@
# TODO
* suckless adblocking
* replace twitch() with proper gtk calls to make scrollbars reappear
* replace webkit with something sane
* add video player options
* play in plugin
* play in video player
* call command with URI (quvi + cclive)

View File

@@ -1,48 +0,0 @@
/*
* Copy me if you can.
* by 20h
*/
#ifndef ARG_H__
#define ARG_H__
extern char *argv0;
/* use main(int argc, char *argv[]) */
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
argv[0] && argv[0][0] == '-'\
&& argv[0][1];\
argc--, argv++) {\
char argc_;\
char **argv_;\
int brk_;\
if (argv[0][1] == '-' && argv[0][2] == '\0') {\
argv++;\
argc--;\
break;\
}\
for (brk_ = 0, argv[0]++, argv_ = argv;\
argv[0][0] && !brk_;\
argv[0]++) {\
if (argv_ != argv)\
break;\
argc_ = argv[0][0];\
switch (argc_)
#define ARGEND }\
}
#define ARGC() argc_
#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

View File

@@ -1 +0,0 @@
#define MSGBUFSZ 8

View File

@@ -1,201 +0,0 @@
/* 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 *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
static char *dldir = "~/dl/";
static char *dlstatus = "~/dl/history/";
static SearchEngine searchengines[] = {
{ " ", "https://duckduckgo.com/?q=%s" },
{ "g ", "https://google.com/search?q=%s" },
};
/* 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 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 DLSTATUS { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"while true; do cat $1/* 2>/dev/null || echo \"No downloads yet.\";"\
"A=; read A; "\
"if [ $A = \"clean\" ]; then rm $1/*; fi; clear; done",\
"surf-dlstatus", dlstatus, NULL } \
}
/* PLUMB(URI) */
/* This called when some URI which does not begin with "about:",
* "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 \
} \
}
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
* the list.
*/
static SiteSpecific 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 */
/*
* If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
* 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) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_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_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_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ 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 } },
/* download-console */
{ MODKEY, GDK_KEY_d, spawndls, { 0 } },
};
/* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
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 },
};

View File

@@ -1,201 +0,0 @@
/* 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 *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
static char *dldir = "~/dl/";
static char *dlstatus = "~/dl/history/";
static SearchEngine searchengines[] = {
{ " ", "https://duckduckgo.com/?q=%s" },
{ "g ", "https://google.com/search?q=%s" },
};
/* 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 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 DLSTATUS { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"while true; do cat $1/* 2>/dev/null || echo \"No downloads yet.\";"\
"A=; read A; "\
"if [ $A = \"clean\" ]; then rm $1/*; fi; clear; done",\
"surf-dlstatus", dlstatus, NULL } \
}
/* PLUMB(URI) */
/* This called when some URI which does not begin with "about:",
* "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 \
} \
}
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
* the list.
*/
static SiteSpecific 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 */
/*
* If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
* 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) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_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_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_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ 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 } },
/* download-console */
{ MODKEY, GDK_KEY_d, spawndls, { 0 } },
};
/* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
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 },
};

View File

@@ -1,32 +0,0 @@
# surf version
VERSION = 2.1
# Customize below to fit your system
# paths
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
LIBPREFIX = $(PREFIX)/lib
LIBDIR = $(LIBPREFIX)/surf
X11INC = `pkg-config --cflags x11`
X11LIB = `pkg-config --libs x11`
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`
# includes and libs
INCS = $(X11INC) $(GTKINC)
LIBS = $(X11LIB) $(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)
# compiler
#CC = c99

View File

@@ -1,226 +0,0 @@
From 0ea5ecb238b932c533413b912b7981a737af56cf Mon Sep 17 00:00:00 2001
From: danoloan10 <danoloan10@tutanota.com>
Date: Thu, 19 Sep 2019 18:25:59 +0200
Subject: [PATCH] Basic integrated downloads via console display
---
config.def.h | 16 ++++---
surf.c | 118 +++++++++++++++++++++++++++++++++++++++------------
2 files changed, 101 insertions(+), 33 deletions(-)
diff --git a/config.def.h b/config.def.h
index 34265f6..375be93 100644
--- a/config.def.h
+++ b/config.def.h
@@ -6,6 +6,8 @@ static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
+static char *dldir = "~/dl/";
+static char *dlstatus = "~/.surf/dlstatus/";
/* Webkit default features */
/* Highest priority value will be used.
@@ -76,13 +78,12 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
} \
}
-/* DOWNLOAD(URI, referer) */
-#define DOWNLOAD(u, r) { \
+#define DLSTATUS { \
.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 \
- } \
+ "while true; do cat $1/* 2>/dev/null || echo \"No downloads yet.\";"\
+ "A=; read A; "\
+ "if [ $A = \"clean\" ]; then rm $1/*; fi; clear; done",\
+ "surf-dlstatus", dlstatus, NULL } \
}
/* PLUMB(URI) */
@@ -180,6 +181,9 @@ static Key keys[] = {
{ 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 } },
+
+ /* download-console */
+ { MODKEY, GDK_KEY_d, spawndls, { 0 } },
};
/* button definitions */
diff --git a/surf.c b/surf.c
index 2b54e3c..771858e 100644
--- a/surf.c
+++ b/surf.c
@@ -205,10 +205,6 @@ static void decidenewwindow(WebKitPolicyDecision *d, Client *c);
static void decideresource(WebKitPolicyDecision *d, Client *c);
static void insecurecontent(WebKitWebView *v, WebKitInsecureContentEvent e,
Client *c);
-static void downloadstarted(WebKitWebContext *wc, WebKitDownload *d,
- Client *c);
-static void responsereceived(WebKitDownload *d, GParamSpec *ps, Client *c);
-static void download(Client *c, WebKitURIResponse *r);
static void webprocessterminated(WebKitWebView *v,
WebKitWebProcessTerminationReason r,
Client *c);
@@ -237,6 +233,17 @@ static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h);
static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h);
+/* download-console */
+static void downloadstarted(WebKitWebContext *wc, WebKitDownload *d,
+ Client *c);
+static void downloadfailed(WebKitDownload *d, GParamSpec *ps, void *arg);
+static void downloadfinished(WebKitDownload *d, GParamSpec *ps, void *arg);
+static gboolean decidedestination(WebKitDownload *d,
+ gchar *suggested_filename, void *arg);
+static void printprogress(WebKitDownload *d, GParamSpec *ps, void *arg);
+static void logdownload(WebKitDownload *d, gchar *tail);
+static void spawndls(Client *c, const Arg *a);
+
static char winid[64];
static char togglestats[12];
static char pagestats[2];
@@ -340,6 +347,8 @@ setup(void)
scriptfile = buildfile(scriptfile);
cachedir = buildpath(cachedir);
certdir = buildpath(certdir);
+ dlstatus = buildpath(dlstatus);
+ dldir = buildpath(dldir);
gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
@@ -1079,6 +1088,8 @@ cleanup(void)
g_free(scriptfile);
g_free(stylefile);
g_free(cachedir);
+ g_free(dldir);
+ g_free(dlstatus);
XCloseDisplay(dpy);
}
@@ -1710,8 +1721,7 @@ decideresource(WebKitPolicyDecision *d, Client *c)
if (webkit_response_policy_decision_is_mime_type_supported(r)) {
webkit_policy_decision_use(d);
} else {
- webkit_policy_decision_ignore(d);
- download(c, res);
+ webkit_policy_decision_download(d);
}
}
@@ -1721,27 +1731,6 @@ insecurecontent(WebKitWebView *v, WebKitInsecureContentEvent e, Client *c)
c->insecure = 1;
}
-void
-downloadstarted(WebKitWebContext *wc, WebKitDownload *d, Client *c)
-{
- g_signal_connect(G_OBJECT(d), "notify::response",
- G_CALLBACK(responsereceived), c);
-}
-
-void
-responsereceived(WebKitDownload *d, GParamSpec *ps, Client *c)
-{
- download(c, webkit_download_get_response(d));
- webkit_download_cancel(d);
-}
-
-void
-download(Client *c, WebKitURIResponse *r)
-{
- Arg a = (Arg)DOWNLOAD(webkit_uri_response_get_uri(r), geturi(c));
- spawn(c, &a);
-}
-
void
webprocessterminated(WebKitWebView *v, WebKitWebProcessTerminationReason r,
Client *c)
@@ -1971,6 +1960,81 @@ clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h)
spawn(c, &arg);
}
+/* download-console */
+
+void
+downloadstarted(WebKitWebContext *wc, WebKitDownload *d, Client *c)
+{
+ webkit_download_set_allow_overwrite(d, TRUE);
+ g_signal_connect(G_OBJECT(d), "decide-destination",
+ G_CALLBACK(decidedestination), NULL);
+ g_signal_connect(G_OBJECT(d), "notify::estimated-progress",
+ G_CALLBACK(printprogress), NULL);
+ g_signal_connect(G_OBJECT(d), "failed",
+ G_CALLBACK(downloadfailed), NULL);
+ g_signal_connect(G_OBJECT(d), "finished",
+ G_CALLBACK(downloadfinished), NULL);
+}
+
+void
+downloadfailed(WebKitDownload *d, GParamSpec *ps, void *arg)
+{
+ logdownload(d, " -- FAILED");
+}
+
+void
+downloadfinished(WebKitDownload *d, GParamSpec *ps, void *arg)
+{
+ logdownload(d, " -- COMPLETED");
+}
+
+gboolean
+decidedestination(WebKitDownload *d, gchar *suggested_filename, void *arg)
+{
+ gchar *dest;
+ dest = g_strdup_printf("file://%s/%s", dldir, suggested_filename);
+ webkit_download_set_destination(d, dest);
+ return TRUE;
+}
+
+void
+printprogress(WebKitDownload *d, GParamSpec *ps, void *arg)
+{
+ logdownload(d, "");
+}
+
+void
+logdownload(WebKitDownload *d, gchar *tail)
+{
+ gchar *filename, *statfile;
+ FILE *stat;
+
+ filename = g_path_get_basename(webkit_download_get_destination(d));
+ statfile = g_strdup_printf("%s/%s", dlstatus, filename);
+
+ if ((stat = fopen(statfile, "w")) == NULL) {
+ perror("dlstatus");
+ } else {
+ fprintf(stat, "%s: %d%% (%d.%ds)%s\n",
+ filename,
+ (int)(webkit_download_get_estimated_progress(d) * 100),
+ (int) webkit_download_get_elapsed_time(d),
+ (int)(webkit_download_get_elapsed_time(d) * 100),
+ tail);
+ fclose(stat);
+ }
+
+ g_free(statfile);
+ g_free(filename);
+}
+
+void
+spawndls(Client *c, const Arg *a)
+{
+ Arg arg = (Arg)DLSTATUS;
+ spawn(c, &arg);
+}
+
int
main(int argc, char *argv[])
{
--
2.22.1

View File

@@ -1,94 +0,0 @@
From 2f64431f15777d93d146707dccdb6ad063c7a316 Mon Sep 17 00:00:00 2001
From: Justinas Grigas <jstn_as@protonmail.com>
Date: Thu, 4 Aug 2022 23:18:40 +0300
Subject: [PATCH] searchengines: allows simple use of search engines
The previous patches had some issues:
* don't apply cleanly to the latest version.
* a space between the token and query is implied, so having " " as a
token means you actually have to use " ". Or if your token is "e",
searching for "example.com" would trigger it. Now you specify the exact
token to look for.
* has checks to skip badly configured search engines. The correct
solution is to configure them right.
Now it works like a better version of the spacesearch patch, as it
allows you to specify " " as a token
---
config.def.h | 5 +++++
surf.c | 22 +++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h
index 075f7d0..7bb9c46 100644
--- a/config.def.h
+++ b/config.def.h
@@ -8,6 +8,11 @@ static char *cachedir = "~/.local/share/surf/cache/";
static char *cookiefile = "~/.local/share/surf/cookies.txt";
static char *historyfile = "~/.local/share/surf/history.txt";
+static SearchEngine searchengines[] = {
+ { " ", "https://duckduckgo.com/?q=%s" },
+ { "osrs ", "https://oldschool.runescape.wiki/?search=%s" },
+};
+
/* Webkit default features */
/* Highest priority value will be used.
* Default parameters are priority 0
diff --git a/surf.c b/surf.c
index a2b507c..7e85952 100644
--- a/surf.c
+++ b/surf.c
@@ -133,6 +133,11 @@ typedef struct {
unsigned int stopevent;
} Button;
+typedef struct {
+ char *token;
+ char *uri;
+} SearchEngine;
+
typedef struct {
const char *uri;
Parameter config[ParameterLast];
@@ -220,6 +225,7 @@ static void webprocessterminated(WebKitWebView *v,
Client *c);
static void closeview(WebKitWebView *v, Client *c);
static void destroywin(GtkWidget* w, Client *c);
+static gchar *parseuri(const gchar *uri);
/* Hotkeys */
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
@@ -584,7 +590,7 @@ loaduri(Client *c, const Arg *a)
url = g_strdup_printf("file://%s", path);
free(path);
} else {
- url = g_strdup_printf("http://%s", uri);
+ url = parseuri(uri);
}
if (apath != uri)
free(apath);
@@ -1811,6 +1817,20 @@ destroywin(GtkWidget* w, Client *c)
gtk_main_quit();
}
+gchar *
+parseuri(const gchar *uri)
+{
+ guint i;
+
+ for (i = 0; i < LENGTH(searchengines); i++) {
+ if (g_str_has_prefix(uri, searchengines[i].token))
+ return g_strdup_printf(searchengines[i].uri,
+ uri + strlen(searchengines[i].token));
+ }
+
+ return g_strdup_printf("http://%s", uri);
+}
+
void
pasteuri(GtkClipboard *clipboard, const char *text, gpointer d)
{
--
2.37.1

Binary file not shown.

View File

@@ -1,32 +0,0 @@
#!/bin/sh
#
# See the LICENSE file for copyright and license details.
#
xidfile="$HOME/tmp/tabbed-surf.xid"
uri=""
if [ "$#" -gt 0 ];
then
uri="$1"
fi
runtabbed() {
tabbed -dn tabbed-surf -r 2 surf -e '' "$uri" >"$xidfile" \
2>/dev/null &
}
if [ ! -r "$xidfile" ];
then
runtabbed
else
xid=$(cat "$xidfile")
xprop -id "$xid" >/dev/null 2>&1
if [ $? -gt 0 ];
then
runtabbed
else
surf -e "$xid" "$uri" >/dev/null 2>&1 &
fi
fi

View File

@@ -1,305 +0,0 @@
.TH SURF 1 surf\-VERSION
.SH NAME
surf \- simple webkit-based browser
.SH SYNOPSIS
.B surf
.RB [-bBdDfFgGiIkKmMnNpPsStTvwxX]
.RB [-a\ cookiepolicies]
.RB [-c\ cookiefile]
.RB [-C\ stylefile]
.RB [-e\ xid]
.RB [-r\ scriptfile]
.RB [-u\ useragent]
.RB [-z\ zoomlevel]
.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
which makes it possible to embed it in another application. Furthermore,
one can point surf to another URI by setting its XProperties.
.SH OPTIONS
.TP
.B \-a cookiepolicies
Define the order of
.I cookie policies\fR.
The default is "@Aa" but could be
redefined in the
.IR 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.
.TP
.B \-B
Enable Scrollbars.
.TP
.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
.B \-D
Enable the disk cache.
.TP
.B \-e xid
Reparents to window specified by
.IR xid .
.TP
.B \-f
Start surf in windowed mode (not fullscreen).
.TP
.B \-F
Start surf in fullscreen mode.
.TP
.B \-g
Disable giving the geolocation to websites.
.TP
.B \-G
Enable giving the geolocation to websites.
.TP
.B \-i
Disable Images.
.TP
.B \-I
Enable Images.
.TP
.B \-k
Disable kiosk mode (disable key strokes and right click).
.TP
.B \-K
Enable kiosk mode (disable key strokes and right click).
.TP
.B \-m
Disable application of user style sheets.
.TP
.B \-M
Enable application of user style sheets.
.TP
.B \-n
Disable the Web Inspector (Developer Tools).
.TP
.B \-N
Enable the Web Inspector (Developer Tools).
.TP
.B \-r scriptfile
Specify the user
.IR scriptfile .
.TP
.B \-s
Disable Javascript.
.TP
.B \-S
Enable Javascript.
.TP
.B \-t
Disable strict TLS check.
.TP
.B \-T
Enable strict TLS check.
.TP
.B \-u useragent
Specify the
.I useragent
which surf should use.
.TP
.B \-v
Prints version information to standard output, then exits.
.TP
.B \-w
Prints xid to standard output. This can be used to script the browser in for
example
.BR xdotool(1) .
.TP
.B -x
Disable custom certificates.
.TP
.B -X
Enable custom certificates.
.TP
.B \-z zoomlevel
Specify the
.I zoomlevel
which surf should use.
.SH USAGE
.B Escape
Stops loading current page or stops download.
.TP
.B Ctrl\-h
Walks back the history.
.TP
.B Ctrl\-l
Walks forward the history.
.TP
.B Ctrl\-k
Scrolls page upwards.
.TP
.B Ctrl\-j
Scrolls page downwards.
.TP
.B Ctrl\-b
Scroll up one whole page view.
.TP
.B Ctrl\-Space
Scroll down one whole page view.
.TP
.B Ctrl\-i
Scroll horizontally to the right.
.TP
.B Ctrl\-u
Scroll horizontally to the left.
.TP
.B Ctrl\-Shift\-k or Ctrl\-+
Zooms page in.
.TP
.B Ctrl\-Shift\-j or Ctrl\--
Zooms page out.
.TP
.B Ctrl\-Shift\-q
Resets Zoom.
.TP
.B Ctrl\-f and Ctrl\-/
Opens the search-bar.
.TP
.B Ctrl\-n
Go to next search result.
.TP
.B Ctrl\-Shift\-n
Go to previous search result.
.TP
.B Ctrl\-g
Opens the URL-bar (requires dmenu installed).
.TP
.B Ctrl\-p
Loads URI from primary selection.
.TP
.B Ctrl\-Shift\-p
Calls Printpage Dialog.
.TP
.B Ctrl\-r
Reloads the website.
.TP
.B Ctrl\-Shift\-r
Reloads the website without using the cache.
.TP
.B Ctrl\-y
Copies current URI to primary selection.
.TP
.B Ctrl\-t
Display the current TLS certificate in a popup window.
.TP
.B Ctrl\-Shift\-a
Toggle through the the
.I cookie policies\fR.
This will not reload the page.
.TP
.B Ctrl\-Shift\-b
Toggle scrollbars. This will reload the page.
.TP
.B Ctrl\-Shift\-c
Toggle caret browsing. This will reload the page.
.TP
.B Ctrl\-Shift\-i
Toggle auto-loading of images. This will reload the page.
.TP
.B Ctrl\-Shift\-m
Toggle if the
.I stylefile
file should be loaded. This will reload the page.
.TP
.B Ctrl\-Shift\-o
Open the Web Inspector (Developer Tools) window for the current page.
.TP
.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.
.TP
.B F11
Toggle fullscreen mode.
.SH INDICATORS OF OPERATION
Surf is showing indicators of operation in front of the site title.
For all indicators, unless otherwise specified, a lower case letter means disabled and an upper case letter means enabled.
.TP
.B A
all cookies accepted
.TP
.B a
no cookies accepted
.TP
.B @
all except third-party cookies accepted
.TP
.B c C
caret browsing
.TP
.B g G
geolocation
.TP
.B d D
disk cache
.TP
.B i I
images
.TP
.B s S
scripts
.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
.TP
.B -
unencrypted
.TP
.B T
encrypted (TLS)
.TP
.B U
attempted encryption but failed
.SS Second character: proxying
.TP
.B -
no proxy
.TP
.B P
using proxy
.SH ENVIRONMENT
.B SURF_USERAGENT
If this variable is set upon startup, surf will use it as the
.I useragent
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 .
.SH SEE ALSO
.BR dmenu(1),
.BR xprop(1),
.BR tabbed(1),
.BR xdotool(1)
.SH BUGS
Please report them!

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

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);
}