Add surf browser and tabbed

This commit is contained in:
2024-06-06 17:13:42 +01:00
parent 41376edb40
commit f2c820e639
24 changed files with 4893 additions and 0 deletions

View File

@@ -463,6 +463,8 @@ if [[ ${main_menu[@]} =~ 1 ]]; then # DWM
compile slock compile slock
compile slstatus compile slstatus
compile st compile st
compile tabbed
compile surf
fi fi
if [[ ${main_menu[@]} =~ 2 ]]; then # GNOME if [[ ${main_menu[@]} =~ 2 ]]; then # GNOME

7
suckless/VERSIONS Normal file
View File

@@ -0,0 +1,7 @@
dmenu - 5.3
dwm - 6.5
st - 0.9.2
slstatus - 1.0
slock - 1.5
surf - 2.1
tabbed - 0.8

48
suckless/surf/LICENSE Normal file
View File

@@ -0,0 +1,48 @@
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.

76
suckless/surf/Makefile Normal file
View File

@@ -0,0 +1,76 @@
# 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

40
suckless/surf/README Normal file
View File

@@ -0,0 +1,40 @@
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

10
suckless/surf/TODO.md Normal file
View File

@@ -0,0 +1,10 @@
# 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)

48
suckless/surf/arg.h Normal file
View File

@@ -0,0 +1,48 @@
/*
* 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

1
suckless/surf/common.h Normal file
View File

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

192
suckless/surf/config.def.h Normal file
View File

@@ -0,0 +1,192 @@
/* 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";
/* 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 \
} \
}
/* 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 \
} \
}
/* 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 } },
};
/* 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 },
};

32
suckless/surf/config.mk Normal file
View File

@@ -0,0 +1,32 @@
# 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

32
suckless/surf/surf-open.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/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

305
suckless/surf/surf.1 Normal file
View File

@@ -0,0 +1,305 @@
.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!

2133
suckless/surf/surf.c Normal file

File diff suppressed because it is too large Load Diff

BIN
suckless/surf/surf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

106
suckless/surf/webext-surf.c Normal file
View File

@@ -0,0 +1,106 @@
#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);
}

23
suckless/tabbed/LICENSE Normal file
View File

@@ -0,0 +1,23 @@
MIT/X Consortium License
© 2009-2011 Enno Boland <g s01 de>
© 2011,2015 Connor Lane Smith <cls@lubutu.com>
© 2012-2015 Christoph Lohmann <20h@r-36.net>
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.

69
suckless/tabbed/Makefile Normal file
View File

@@ -0,0 +1,69 @@
.POSIX:
NAME = tabbed
VERSION = 0.8
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
DOCPREFIX = ${PREFIX}/share/doc/${NAME}
# use system flags.
TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2 ${CFLAGS}
TABBED_LDFLAGS = -L/usr/X11R6/lib -lX11 -lfontconfig -lXft ${LDFLAGS}
TABBED_CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700L
# OpenBSD (uncomment)
#TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 ${CFLAGS}
SRC = tabbed.c xembed.c
OBJ = ${SRC:.c=.o}
BIN = ${OBJ:.o=}
MAN1 = ${BIN:=.1}
HDR = arg.h config.def.h
DOC = LICENSE README
all: ${BIN}
.c.o:
${CC} -o $@ -c $< ${TABBED_CFLAGS} ${TABBED_CPPFLAGS}
${OBJ}: config.h
config.h:
cp config.def.h $@
.o:
${CC} -o $@ $< ${TABBED_LDFLAGS}
clean:
rm -f ${BIN} ${OBJ} "${NAME}-${VERSION}.tar.gz"
dist: clean
mkdir -p "${NAME}-${VERSION}"
cp -fR Makefile ${MAN1} ${DOC} ${HDR} ${SRC} "${NAME}-${VERSION}"
tar -cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz"
rm -rf ${NAME}-${VERSION}
install: all
# installing executable files.
mkdir -p "${DESTDIR}${PREFIX}/bin"
cp -f ${BIN} "${DESTDIR}${PREFIX}/bin"
for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done
# installing doc files.
mkdir -p "${DESTDIR}${DOCPREFIX}"
cp -f README "${DESTDIR}${DOCPREFIX}"
# installing manual pages for general commands: section 1.
mkdir -p "${DESTDIR}${MANPREFIX}/man1"
for m in ${MAN1}; do sed "s/VERSION/${VERSION}/g" < $$m > "${DESTDIR}${MANPREFIX}/man1/$$m"; done
uninstall:
# removing executable files.
for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done
# removing doc files.
rm -f "${DESTDIR}${DOCPREFIX}/README"
# removing manual pages.
for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done
-rmdir "${DESTDIR}${DOCPREFIX}"
.PHONY: all clean dist install uninstall

22
suckless/tabbed/README Normal file
View File

@@ -0,0 +1,22 @@
tabbed - generic tabbed interface
=================================
tabbed is a simple tabbed X window container.
Requirements
------------
In order to build tabbed you need the Xlib header files.
Installation
------------
Edit config.mk to match your local setup (tabbed is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install tabbed
(if necessary as root):
make clean install
Running tabbed
--------------
See the man page for details.

48
suckless/tabbed/arg.h Normal file
View File

@@ -0,0 +1,48 @@
/*
* 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

@@ -0,0 +1,66 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "monospace:size=9";
static const char* normbgcolor = "#222222";
static const char* normfgcolor = "#cccccc";
static const char* selbgcolor = "#555555";
static const char* selfgcolor = "#ffffff";
static const char* urgbgcolor = "#111111";
static const char* urgfgcolor = "#cc0000";
static const char before[] = "<";
static const char after[] = ">";
static const char titletrim[] = "...";
static const int tabwidth = 200;
static const Bool foreground = True;
static Bool urgentswitch = False;
/*
* Where to place a new tab when it is opened. When npisrelative is True,
* then the current position is changed + newposition. If npisrelative
* is False, then newposition is an absolute position.
*/
static int newposition = 0;
static Bool npisrelative = False;
#define SETPROP(p) { \
.v = (char *[]){ "/bin/sh", "-c", \
"prop=\"`xwininfo -children -id $1 | grep '^ 0x' |" \
"sed -e's@^ *\\(0x[0-9a-f]*\\) \"\\([^\"]*\\)\".*@\\1 \\2@' |" \
"xargs -0 printf %b | dmenu -l 10 -w $1`\" &&" \
"xprop -id $1 -f $0 8s -set $0 \"$prop\"", \
p, winid, NULL \
} \
}
#define MODKEY ControlMask
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY|ShiftMask, XK_Return, focusonce, { 0 } },
{ MODKEY|ShiftMask, XK_Return, spawn, { 0 } },
{ MODKEY|ShiftMask, XK_l, rotate, { .i = +1 } },
{ MODKEY|ShiftMask, XK_h, rotate, { .i = -1 } },
{ MODKEY|ShiftMask, XK_j, movetab, { .i = -1 } },
{ MODKEY|ShiftMask, XK_k, movetab, { .i = +1 } },
{ MODKEY, XK_Tab, rotate, { .i = 0 } },
{ MODKEY, XK_grave, spawn, SETPROP("_TABBED_SELECT_TAB") },
{ MODKEY, XK_1, move, { .i = 0 } },
{ MODKEY, XK_2, move, { .i = 1 } },
{ MODKEY, XK_3, move, { .i = 2 } },
{ MODKEY, XK_4, move, { .i = 3 } },
{ MODKEY, XK_5, move, { .i = 4 } },
{ MODKEY, XK_6, move, { .i = 5 } },
{ MODKEY, XK_7, move, { .i = 6 } },
{ MODKEY, XK_8, move, { .i = 7 } },
{ MODKEY, XK_9, move, { .i = 8 } },
{ MODKEY, XK_0, move, { .i = 9 } },
{ MODKEY, XK_q, killclient, { 0 } },
{ MODKEY, XK_u, focusurgent, { 0 } },
{ MODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } },
{ 0, XK_F11, fullscreen, { 0 } },
};

171
suckless/tabbed/tabbed.1 Normal file
View File

@@ -0,0 +1,171 @@
.TH TABBED 1 tabbed\-VERSION
.SH NAME
tabbed \- generic tabbed interface
.SH SYNOPSIS
.B tabbed
.RB [ \-c ]
.RB [ \-d ]
.RB [ \-k ]
.RB [ \-s ]
.RB [ \-v ]
.RB [ \-g
.IR geometry ]
.RB [ \-n
.IR name ]
.RB [ \-p
.RB [ s {+/-} ] \fIpos\fR ]
.RB [ \-o
.IR normbgcol ]
.RB [ \-O
.IR normfgcol ]
.RB [ \-t
.IR selbgcol ]
.RB [ \-T
.IR selfgcol ]
.RB [ \-u
.IR urgbgcol ]
.RB [ \-U
.IR urgfgcol ]
.RB [ \-r
.IR narg ]
.RI [ "command ..." ]
.SH DESCRIPTION
.B tabbed
is a simple tabbed container for applications which support XEmbed. Tabbed
will then run the provided command with the xid of tabbed as appended
argument. (See EXAMPLES.) The automatic spawning of the command can be
disabled by providing the -s parameter. If no command is provided
tabbed will just print its xid and run no command.
.SH OPTIONS
.TP
.B \-c
close tabbed when the last tab is closed. Mutually exclusive with -f.
.TP
.B \-d
detaches tabbed from the terminal and prints its XID to stdout.
.TP
.B \-f
fill up tabbed again by spawning the provided command, when the last tab is
closed. Mutually exclusive with -c.
.TP
.BI \-g " geometry"
defines the X11 geometry string, which will fixate the height and width of
tabbed.
The syntax is
.RI [=][ width {xX} height ][{+-} xoffset {+-} yoffset ].
See
.BR XParseGeometry (3)
for further details.
.TP
.B \-k
close foreground tabbed client (instead of tabbed and all clients) when
WM_DELETE_WINDOW is sent.
.TP
.BI \-n " name"
will set the WM_CLASS attribute to
.I name.
.TP
.BR \-p " [" s {+-}] \fIpos\fR
will set the absolute or relative position of where to start a new tab. When
.I pos
is is given without 's' in front it is an absolute position. Then negative
numbers will be the position from the last tab, where -1 is the last tab.
If 's' is given, then
.I pos
is a relative position to the current selected tab. If this reaches the limits
of the tabs; those limits then apply.
.TP
.BI \-r " narg"
will replace the
.I narg
th argument in
.I command
with the window id, rather than appending it to the end.
.TP
.B \-s
will disable automatic spawning of the command.
.TP
.BI \-o " normbgcol"
defines the normal background color.
.RI # RGB ,
.RI # RRGGBB ,
and X color names are supported.
.TP
.BI \-O " normfgcol"
defines the normal foreground color.
.TP
.BI \-t " selbgcol"
defines the selected background color.
.TP
.BI \-T " selfgbcol"
defines the selected foreground color.
.TP
.BI \-u " urgbgcol"
defines the urgent background color.
.TP
.BI \-U " urgfgbcol"
defines the urgent foreground color.
.TP
.B \-v
prints version information to stderr, then exits.
.SH USAGE
.TP
.B Ctrl\-Shift\-Return
open new tab
.TP
.B Ctrl\-Shift\-h
previous tab
.TP
.B Ctrl\-Shift\-l
next tab
.TP
.B Ctrl\-Shift\-j
move selected tab one to the left
.TP
.B Ctrl\-Shift\-k
move selected tab one to the right
.TP
.B Ctrl\-Shift\-u
toggle autofocus of urgent tabs
.TP
.B Ctrl\-Tab
toggle between the selected and last selected tab
.TP
.B Ctrl\-`
open dmenu to either create a new tab appending the entered string or select
an already existing tab.
.TP
.B Ctrl\-q
close tab
.TP
.B Ctrl\-u
focus next urgent tab
.TP
.B Ctrl\-[0..9]
jumps to nth tab
.TP
.B F11
Toggle fullscreen mode.
.SH EXAMPLES
$ tabbed surf -e
.TP
$ tabbed urxvt -embed
.TP
$ tabbed xterm -into
.TP
$ $(tabbed -d >/tmp/tabbed.xid); urxvt -embed $(</tmp/tabbed.xid);
.TP
$ tabbed -r 2 st -w '' -e tmux
.SH CUSTOMIZATION
.B tabbed
can be customized by creating a custom config.h and (re)compiling the source
code. This keeps it fast, secure and simple.
.SH AUTHORS
See the LICENSE file for the authors.
.SH LICENSE
See the LICENSE file for the terms of redistribution.
.SH SEE ALSO
.BR st (1),
.BR xembed (1)
.SH BUGS
Please report them.

1382
suckless/tabbed/tabbed.c Normal file

File diff suppressed because it is too large Load Diff

35
suckless/tabbed/xembed.1 Normal file
View File

@@ -0,0 +1,35 @@
.TH XEMBED 1 tabbed\-VERSION
.SH NAME
xembed \- XEmbed foreground process
.SH SYNOPSIS
.B xembed
.I flag command
.RI [ "argument ..." ]
.SH DESCRIPTION
If the environment variable XEMBED is set, and
.B xembed
is in the foreground of its controlling tty, it will execute
.IP
command flag $XEMBED [argument ...]
.LP
Otherwise it will execute
.IP
command [argument ...]
.LP
.SH EXAMPLE
In a terminal emulator within a
.B tabbed
session, the shell alias
.IP
$ alias surf='xembed -e surf'
.LP
will cause `surf' to open in a new tab, unless it is run in the background,
i.e. `surf &', in which case it will instead open in a new window.
.SH AUTHORS
See the LICENSE file for the authors.
.SH LICENSE
See the LICENSE file for the terms of redistribution.
.SH SEE ALSO
.BR tabbed (1)
.SH BUGS
Please report them.

45
suckless/tabbed/xembed.c Normal file
View File

@@ -0,0 +1,45 @@
/*
* See LICENSE file for copyright and license details.
*/
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
char *xembed;
int tty;
pid_t pgrp, tcpgrp;
if (argc < 3) {
fprintf(stderr, "usage: %s flag cmd ...\n", argv[0]);
return 2;
}
if (!(xembed = getenv("XEMBED")))
goto noembed;
if ((tty = open("/dev/tty", O_RDONLY)) < 0)
goto noembed;
pgrp = getpgrp();
tcpgrp = tcgetpgrp(tty);
close(tty);
if (pgrp == tcpgrp) { /* in foreground of tty */
argv[0] = argv[2];
argv[2] = xembed;
} else {
noembed:
argv += 2;
}
execvp(argv[0], argv);
perror(argv[0]); /* failed to execute */
return 1;
}