diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | LICENSE | 1 | ||||
-rw-r--r-- | Makefile | 68 | ||||
-rw-r--r-- | PATCHES | 4 | ||||
-rw-r--r-- | README | 13 | ||||
-rw-r--r-- | browser.c | 80 | ||||
-rw-r--r-- | man1/lariza.1 | 237 | ||||
-rw-r--r-- | man1/lariza.usage.1 | 338 | ||||
-rwxr-xr-x | tools/install.sh | 48 |
10 files changed, 463 insertions, 331 deletions
@@ -1,2 +1,3 @@ lariza we_adblock.so +*.d @@ -1,5 +1,9 @@ Release history for lariza +v21.06 2021-06-19 + [Fixed] + - Setting a preferred language works again (workaround in place). + v21.01 2021-01-22 [Changed] - The file "adblock.black" has been renamed to "adblock". @@ -1,5 +1,6 @@ MIT License +Copyright (c) 2021 Cem Keylan Copyright (c) 2014-2021 Peter Hofmann Copyright (c) 2016 Étienne Deparis Copyright (c) 2017 Camille Scholtz @@ -1,53 +1,65 @@ -CFLAGS += -Wall -Wextra -Wno-unused-parameter -O3 +.POSIX: + +_CFLAGS = $(CFLAGS) -Wall -Wextra -Wno-unused-parameter -O3 __NAME__ = lariza __NAME_UPPERCASE__ = LARIZA -INSTALL = install -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) -m 644 - -prefix = /usr/local -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib -datarootdir = $(prefix)/share -mandir = $(datarootdir)/man -man1dir = $(mandir)/man1 -datadir = $(prefix)/share +INSTALL = ./tools/install.sh +INSTALL_PROGRAM = $(INSTALL) -Dm 755 +INSTALL_DATA = $(INSTALL) -Dm 644 +PREFIX = /usr/local +EXEC_PREFIX = $(PREFIX) +BINDIR = $(EXEC_PREFIX)/bin +LIBDIR = $(EXEC_PREFIX)/lib +DATAROOTDIR = $(PREFIX)/share +MANDIR = $(DATAROOTDIR)/man +MAN1DIR = $(MANDIR)/man1 +DATADIR = $(PREFIX)/share -.PHONY: all clean install installdirs all: $(__NAME__) we_adblock.so +-include browser.c.d +-include we_adblock.c.d + $(__NAME__): browser.c - $(CC) $(CFLAGS) $(LDFLAGS) \ + $(CC) $(_CFLAGS) $(LDFLAGS) \ -D__NAME__=\"$(__NAME__)\" \ -D__NAME_UPPERCASE__=\"$(__NAME_UPPERCASE__)\" \ - -o $@ $< \ + -MD -MF browser.c.d \ + -o $@ browser.c \ `pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0` we_adblock.so: we_adblock.c - $(CC) $(CFLAGS) $(LDFLAGS) \ + $(CC) $(_CFLAGS) $(LDFLAGS) \ -D__NAME__=\"$(__NAME__)\" \ -D__NAME_UPPERCASE__=\"$(__NAME_UPPERCASE__)\" \ - -shared -o $@ -fPIC $< \ + -MD -MF we_adblock.c.d \ + -shared -o $@ -fPIC we_adblock.c \ `pkg-config --cflags --libs glib-2.0 webkit2gtk-4.0` -install: all installdirs - $(INSTALL_PROGRAM) $(__NAME__) $(DESTDIR)$(bindir)/$(__NAME__) - $(INSTALL_DATA) man1/$(__NAME__).1 $(DESTDIR)$(man1dir)/$(__NAME__).1 +install: all + $(INSTALL_PROGRAM) $(__NAME__) $(DESTDIR)$(BINDIR)/$(__NAME__) + $(INSTALL_DATA) man1/$(__NAME__).1 $(DESTDIR)$(MAN1DIR)/$(__NAME__).1 $(INSTALL_DATA) man1/$(__NAME__).usage.1 \ - $(DESTDIR)$(man1dir)/$(__NAME__).usage.1 + $(DESTDIR)$(MAN1DIR)/$(__NAME__).usage.1 $(INSTALL_PROGRAM) we_adblock.so \ - $(DESTDIR)$(libdir)/$(__NAME__)/web_extensions/we_adblock.so + $(DESTDIR)$(LIBDIR)/$(__NAME__)/web_extensions/we_adblock.so $(INSTALL_DATA) user-scripts/hints.js \ - $(DESTDIR)$(datadir)/$(__NAME__)/user-scripts/hints.js + $(DESTDIR)$(DATADIR)/$(__NAME__)/user-scripts/hints.js -installdirs: - mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) \ - $(DESTDIR)$(libdir)/$(__NAME__)/web_extensions \ - $(DESTDIR)$(datadir)/$(__NAME__)/user-scripts +uninstall: + rm -f $(DESTDIR)$(BINDIR)/$(__NAME__) \ + $(DESTDIR)$(MAN1DIR)/$(__NAME__).1 \ + $(DESTDIR)$(MAN1DIR)/$(__NAME__).usage.1 + rm -rf $(DESTDIR)$(LIBDIR)/$(__NAME__) \ + $(DESTDIR)$(DATADIR)/$(__NAME__) clean: rm -f $(__NAME__) we_adblock.so + +allclean: clean + rm -f browser.c.d we_adblock.c.d + +.PHONY: all allclean clean install uninstall @@ -10,7 +10,9 @@ The project used to be hosted on GitHub, so there is a couple of forks: https://github.com/vain/lariza/network/members -I'm not aware of any non-GitHub forks at the moment. +Non-GitHub forks: + + https://chorizo.armaanb.net Why? @@ -1,3 +1,16 @@ +This is my personal build of lariza. I have changed some keybindings and added +a couple features to fit my needs: + +- Search engine functionality [Ctrl+S] +- File chooser for downloads +- Permission handling dialogues +- Cookie support + +The manual pages have been updated to reflect all of these changes. + +Original README +--------------- + _ _ | | __ _ _ __(_)______ _ | |/ _` | '__| |_ / _` | @@ -1,3 +1,4 @@ +#define _XOPEN_SOURCE 700 #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -90,6 +91,7 @@ gboolean cooperative_alone = TRUE; gboolean cooperative_instances = TRUE; int cooperative_pipe_fp = 0; gchar *download_dir = "/var/tmp"; +gchar *search_engine = SEARCH_ENGINE; gboolean enable_console_to_stdout = FALSE; gchar *fifo_suffix = "main"; gdouble global_zoom = 1.0; @@ -129,6 +131,7 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show, struct Client *c; gchar *f; GtkWidget *evbox, *tabbox; + WebKitWebContext *wc; if (uri != NULL && cooperative_instances && !cooperative_alone) { @@ -153,6 +156,17 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show, else c->web_view = webkit_web_view_new_with_related_view(related_wv); + /* XXX We have just created a new WebView with either the default + * WebContext (if related_wv == NULL) or a WebView with an inherited + * context. Still, it doesn't use the preferred languages we might + * have set on the default WebContext. This used to work. New bug in + * WebKit or changed API? */ + if (accepted_language[0] != NULL) + { + wc = webkit_web_view_get_context(WEBKIT_WEB_VIEW(c->web_view)); + webkit_web_context_set_preferred_languages(wc, accepted_language); + } + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), global_zoom); g_signal_connect(G_OBJECT(c->web_view), "notify::favicon", G_CALLBACK(changed_favicon), c); @@ -524,34 +538,43 @@ download_handle_start(WebKitWebView *web_view, WebKitDownload *download, gboolean download_handle(WebKitDownload *download, gchar *suggested_filename, gpointer data) { - gchar *sug_clean, *path, *path2 = NULL, *uri; + gchar *sug_clean, *path = NULL, *uri; GtkToolItem *tb; - int suffix = 1; size_t i; + GtkWidget *dialog; + GtkFileChooser *chooser; + gint res; + + dialog = gtk_file_chooser_dialog_new("Save File", + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + "Cancel", + GTK_RESPONSE_CANCEL, + "Save", + GTK_RESPONSE_ACCEPT, + NULL); sug_clean = g_strdup(suggested_filename); for (i = 0; i < strlen(sug_clean); i++) if (sug_clean[i] == G_DIR_SEPARATOR) sug_clean[i] = '_'; - path = g_build_filename(download_dir, sug_clean, NULL); - path2 = g_strdup(path); - while (g_file_test(path2, G_FILE_TEST_EXISTS) && suffix < 1000) + chooser = GTK_FILE_CHOOSER(dialog); + gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE); + gtk_file_chooser_set_current_name(chooser, sug_clean); + gtk_file_chooser_set_current_folder(chooser, download_dir); + gtk_widget_show_all(dialog); + res = gtk_dialog_run(GTK_DIALOG(dialog)); + if (res != GTK_RESPONSE_ACCEPT) { - g_free(path2); - - path2 = g_strdup_printf("%s.%d", path, suffix); - suffix++; - } - - if (suffix == 1000) - { - fprintf(stderr, __NAME__": Suffix reached limit for download.\n"); webkit_download_cancel(download); + gtk_widget_destroy(dialog); } else { - uri = g_filename_to_uri(path2, NULL, NULL); + path = gtk_file_chooser_get_filename(chooser); + gtk_widget_destroy(dialog); + uri = g_filename_to_uri(path, NULL, NULL); webkit_download_set_destination(download, uri); g_free(uri); @@ -575,7 +598,6 @@ download_handle(WebKitDownload *download, gchar *suggested_filename, gpointer da g_free(sug_clean); g_free(path); - g_free(path2); /* Propagate -- to whom it may concern. */ return FALSE; @@ -649,7 +671,7 @@ ensure_uri_scheme(const gchar *t) } else { if (g_str_has_prefix(f, "!/")) - f = g_strdup_printf(SEARCH_ENGINE, t + 2); + f = g_strdup_printf(search_engine, t + 2); else f = g_strdup_printf("http://%s", t); } @@ -668,10 +690,28 @@ grab_environment_configuration(void) if (e != NULL) accepted_language[0] = g_strdup(e); + /* + * Accept XDG_DOWNLOAD_DIR as a valid download directory if + * LARIZA_DOWNLOAD_DIR is not specifically set. Since the XDG user directory + * specification is extremely stupid, and depends on a certain xdg-user-dir + * binary, we do two runs for acquiring the XDG_DOWNLOAD_DIR. We look at the + * environment variables (which what this specification should have been), + * and use g_get_user_special_dir() if that fails. + */ e = g_getenv(__NAME_UPPERCASE__"_DOWNLOAD_DIR"); + if (e == NULL) + e = g_getenv("XDG_DOWNLOAD_DIR"); + if (e == NULL) + e = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD); + if (e == NULL) + e = g_build_filename(g_get_home_dir(), "Downloads", NULL); if (e != NULL) download_dir = g_strdup(e); + e = g_getenv(__NAME_UPPERCASE__"_SEARCH_ENGINE"); + if (e != NULL) + search_engine = g_strdup(e); + e = g_getenv(__NAME_UPPERCASE__"_ENABLE_CONSOLE_TO_STDOUT"); if (e != NULL) enable_console_to_stdout = TRUE; @@ -861,9 +901,6 @@ init_default_web_context(void) webkit_web_context_set_web_extensions_directory(wc, p); g_free(p); - if (accepted_language[0] != NULL) - webkit_web_context_set_preferred_languages(wc, accepted_language); - g_signal_connect(G_OBJECT(wc), "download-started", G_CALLBACK(download_handle_start), NULL); @@ -918,6 +955,7 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data) search(c, 1); return TRUE; case GDK_KEY_3: /* search backward (left hand) */ + case GDK_KEY_N: /* search backward (maybe both hands) */ search(c, -1); return TRUE; case GDK_KEY_o: /* location (BOTH hands) */ @@ -1155,7 +1193,7 @@ permission_request(WebKitWebView *v, WebKitPermissionRequest *r, gpointer data) { struct Client *c = (struct Client *)data; const gchar *h; - char *permission_str; + const gchar *permission_str; h = g_uri_get_host(g_uri_parse( webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)), diff --git a/man1/lariza.1 b/man1/lariza.1 index e0294db..a1b6b31 100644 --- a/man1/lariza.1 +++ b/man1/lariza.1 @@ -1,119 +1,130 @@ -.TH lariza 1 "2021-01-03" "lariza" "User Commands" -.\" -------------------------------------------------------------------- -.SH NAME -lariza \- simple web browser -.\" -------------------------------------------------------------------- -.SH SYNOPSIS -\fBlariza\fP -[\fB\-C\fP] -[\fIURI ...\fP] -.\" -------------------------------------------------------------------- -.SH DESCRIPTION -\fBlariza\fP is a simple web browser using GTK+ 3, GLib and WebKit2GTK+. -.\" -------------------------------------------------------------------- -.SH OPTIONS -In addition to the standard arguments of GTK+ 3, \fBlariza\fP knows -about the following options: -.TP -\fB\-C\fP +.Dd Jul 17, 2021 +.Dt lariza 1 +.Sh NAME +.Nm lariza +.Nd simple web browser +.Sh SYNOPSIS +.Nm +.Op Fl C +.Op Ar URI... +.Sh DESCRIPTION +.Nm +is a simple web browser using GTK+3, GLib and Webkit2GTK+ +.Sh OPTIONS +In addition to the standard arguments of GTK+3, +.Nm +knows about the following options: +.Bl -tag +.It Fl C Disables cooperative instances. -.P -After these options there can be any number of URIs. If no URIs are -given, $\fBLARIZA_HOME_URI\fP will be opened. -.\" -------------------------------------------------------------------- -.SH ENVIRONMENT -In addition to the standard variables of GTK+ 3, \fBlariza\fP knows -about the following environment variables: -.P -.TP -\fBLARIZA_ACCEPTED_LANGUAGE\fP -In HTTP requests, WebKit sets the \(lqAccepted-Language\(rq header to -this value. Defaults to \fBen-US\fP. -.TP -\fBLARIZA_DOWNLOAD_DIR\fP -All downloads are automatically stored in this directory. If you want to -stick to XDG directories, then you should configure your -\(lqxdg-user-dirs\(rq and use this: - -\f(CW -.nf -\&LARIZA_DOWNLOAD_DIR=$(xdg-user-dir DOWNLOAD) -.fi -\fP - -This variable defaults to \fB/var/tmp\fP. -.TP -\fBLARIZA_ENABLE_CONSOLE_TO_STDOUT\fP +.El +.Pp +After these options there can be any number of +.Ar URIs . +If no +.Ar URIs +are given, $\fBLARIZA_HOME_URI\fP will be opened. +.Sh ENVIRONMENT +In addition to the standard variables of GTK+3, +.Nm +knows about the following environment variables: +.Bl -tag +.It Sy LARIZA_ACCEPTED_LANGUAGE +In HTTP requests, WebKit sets the +.Dq Accepted-Language +header to this value. Defaults to +.Sy en-US . +.It Sy LARIZA_DOWNLOAD_DIR +All downloads are automatically stored in this directory. If this variable, +doesn't exist, +.Nm +will try to form a directory using the +.Ev XDG_DOWNLOAD_DIR +specification, and fallback to +.Pa /var/tmp +if it fails. +.It Sy LARIZA_ENABLE_CONSOLE_TO_STDOUT Enable writing WebKit console messages to stdout. -.TP -\fBLARIZA_FIFO_SUFFIX\fP -Cooperative instances are implemented using a named pipe in the file -system. The name of this pipe usually is (at least on modern systems -following XDG \(lqstandards\(rq): -\fI/var\:/run\:/user\:/$UID\:/lariza.fifo\:-$LARIZA_FIFO_SUFFIX\fP. - -$\fBUID\fP is the id of your user. $\fBLARIZA_FIFO_SUFFIX\fP defaults to -\fBmain\fP. If you change this variable, you can launch several -independent cooperative instances of \fBlariza\fP. -.TP -\fBLARIZA_HISTORY_FILE\fP -If set, \fBlariza\fP will write each visited URI to that file. This path -can point to a named pipe, but be aware that the browser will block -until a reader at the other end of the pipe has read all pending data. -.TP -\fBLARIZA_HOME_URI\fP -This URI will be opened by pressing the appropriate hotkeys -(\(lqhomepage\(rq or \(lqnew window\(rq) and if no URIs are specified on -the command line. Defaults to \fBabout:blank\fP. -.TP -\fBLARIZA_TAB_POS\fP -Can be one of \fBtop\fP (default), \fBright\fP, \fBbottom\fP, -\fBleft\fP. -.TP -\fBLARIZA_TAB_WIDTH_CHARS\fP +.It Sy LARIZA_FIFO_SUFFIX +Cooperative instances are implemented using a named pipe in the file system. The +name of this pipe usually is +.Pq at least on modern systems following XDG Dq standards : +.Pa /var/run/user/$UID/lariza.fifo-$LARIZA_FIFO_SUFFIX . +.Pp +.Sy $UID +is the id of your user. +.Sy $LARIZA_FIFO_SUFFIX +defaults to +.Sy main . +If you change this variable, you can launch several independent cooperative +instances of +.Nm . +.It Sy LARIZA_HISTORY_FILE +If set, +.Nm +will write each visited URI to that file. This path can point to a named pipe, +but be aware that the browser will block until a reader at the other end of the +pipe has read all pending data. +.It Sy LARIZA_HOME_URI +This URI will be opened by pressing the appropriate hokeys +.Pq Do homepage Dc or Do new window Dc +and if no URIs are specified on the command line. Defaults to +.Sy about:blank . +.It Sy LARIZA_SEARCH_ENGINE +This URI will be used to format the given search. The URI must contain a +.Sq %s +so that the search can be formatted. This option can also be changed from the +.Pa config.h +file during compilation time. Defaults to +.Lk https://duckduckgo.com/?q=%s +.It Sy LARIZA_TAB_POS +Can be one of +.Sy top +.Pq default , +.Sy right , bottom, left . +.It Sy LARIZA_TAB_WIDTH_CHARS An integer, determines width of tabs. Defaults to 20. -.TP -\fBLARIZA_USER_AGENT\fP -\fBlariza\fP will identify itself with this string. Uses WebKit's -default value if unset. -.TP -\fBLARIZA_ZOOM -Zoom level for WebKit viewports. Defaults to \fB1.0\fP. -.\" -------------------------------------------------------------------- -.SH FILES +.It Sy LARIZA_USER_AGENT +.Nm +will identify itself with this string. Uses WebKit's default value if unset. +.It Sy LARIZA_ZOOM +Zoom level for WebKit viewports. Defaults to 1.0. +.El +.Sh FILES XDG variables will be used to construct these paths. -.TP -\fI~/.config\:/lariza\:/adblock\fP -Adblock patterns. See \fBlariza.usage\fP(1). -.TP -\fI~/.config\:/lariza\:/certs\fP +.Bl -tag +.It Pa ~/.config/lariza/adblock +Adblock patterns. See +.Xr lariza.usage 1 . +.It Pa ~/.config/lariza/certs Directory where trusted certificates are stored. See -\fBlariza.usage\fP(1). -.TP -\fI~/.config\:/lariza\:/scripts\fP +.Xr lariza.usage 1 . +.It Pa ~/.config/lariza/scripts Directory to store user-supplied JavaScript snippets. See -\fBlariza.usage\fP(1). -.TP -\fI~/.local\:/share\:/lariza\:/web_extensions\fP -Sets the directory where WebKit will look for web extensions. See -\fBlariza.usage\fP(1). -.TP -\fI~/.cache\:/lariza\fP -.TQ -\fI~/.cache\:/webkitgtk\fP -.TQ -\fI~/.local\:/share\:/webkitgtk\fP -WebKitGTK will dump its caches and local storage here. It is probably -wise to clean those directories regularly or to mount them as -\fBtmpfs\fP(5). -.\" -------------------------------------------------------------------- -.SH LICENSE -\fBlariza\fP is released under the MIT license. See the accompanying -\fILICENSE\fP file. -.\" -------------------------------------------------------------------- -.SH HISTORY -\fBlariza\fP was originally written by Peter Hofmann. The project -was started in June 2014. -.\" -------------------------------------------------------------------- -.SH "SEE ALSO" -.BR lariza.usage (1). +.Xr lariza.usage 1 . +.It Pa ~/.cache/lariza , ~/.cache/webkitgtk , ~/.local/share/webkitgtk +WebKitGTK will dump its caches and local storage here. +.It Pa ~/.cache/lariza/cookies.txt +.Nm +will save its cookies in this text file. +.El +.Sh LICENSE +.Nm +is released under the MIT license. See the accompanying +.Pa LICENSE +file. +.Sh NOTES +This is a fork of +.Nm , +and not the original source. If you want the original source, visit +.Lk https://uninformativ.de/git/lariza . +.Pp +The source of this fork is available on +.Lk https://git.carbslinux.org/users/merakor/lariza . +Send bug reports to +.An Cem Keylan Aq Mt cem@ckyln.com . +.Sh HISTORY +.Nm +was originally written by Peter Hofmann. The project was started in June 2014. +.Sh SEE ALSO +.Xr lariza.usage 1 diff --git a/man1/lariza.usage.1 b/man1/lariza.usage.1 index 3682c60..4dac0d6 100644 --- a/man1/lariza.usage.1 +++ b/man1/lariza.usage.1 @@ -1,183 +1,185 @@ -.TH lariza 1 "2021-01-03" "lariza" "User Commands" -.\" -------------------------------------------------------------------- -.SH NAME -lariza.usage \- extended usage hints -.\" -------------------------------------------------------------------- -.SH DESCRIPTION -\fBlariza\fP is a simple web browser using GTK+ 3, GLib and WebKit2GTK+. -This manpage contains additional hints and pointers regarding its usage. -.\" -------------------------------------------------------------------- -.SH "HOTKEYS" -.SS "Global hotkeys" +.Dd Jul 17, 2021 +.Dt lariza.usage 1 +.Sh NAME +.Nm lariza +.Nd extended usage hints +.Sh DESCRIPTION +.Nm +is a simple web browser using GTK+3, GLib and WebKit2GTK+. This manpage contains +additional hints and pointers regarding its usage. +.Sh HOTKEYS +.Ss Global hotkeys These hotkeys work when either the location bar or the web view is being focused. -.TP -\fBMod1\fP + \fBq\fP -Close the current window. Quits the entire program if this was the last -window and if there are no more active downloads (download manager is -shown otherwise). -.TP -\fBMod1\fP + \fBw\fP -Go to your \(lqhomepage\(rq. See the environment variable -$\fBLARIZA_HOME_URI\fP. -.TP -\fBMod1\fP + \fBe\fP -Open a new window. -.TP -\fBMod1\fP + \fBr\fP +.Bl -tag +.It Sy Ctrl + q +Close the current window. Quits the entire program if this was the last window +and if there are no more active downloads +.Pq download manager is shown otherwise . +.It Sy Ctrl + w +Go to your +.Dq homepage . +See the environment variable +.Sy $LARIZA_HOME_URI . +.It Sy Ctrl + t +Open a new window . +.Ir Sy Ctrl + r Reload the current page. -.TP -\fBMod1\fP + \fBd\fP +.It Sy Ctrl + d Open the download manager. -.TP -\fBMod1\fP + \fBl\fP +.It Sy Ctrl + o Focus the location bar. -.TP -\fBMod1\fP + \fBk\fP -Focus the location bar and set its text to \fB:/\fP, allowing you to -easily initiate a search. -.TP -\fBMod1\fP + \fB2\fP -.TQ -\fBMod1\fP + \fBn\fP -Repeat the last search (forward). -.TP -\fBMod1\fP + \fB3\fP -Repeat the last search (backward). -.TP -\fBMod1\fP + \fBc\fP +.It Sy Ctrl + f +Focus the location bar and set its text to +.Dq :/ , +allowing you to easily initiate a search. +.It Sy Ctrl + s +Focus the location bar and set its text to +.Dq !/ , +allowin you to search through the search engine. +.It Sy Ctrl + 2 , Ctrl + n +Repeat the last search +.Pq forward . +.It Sy Ctrl + 3 , Ctrl + Shift + n +Repeat the last search +.Pq backward . +.It Sy Ctrl + c Reload trusted certificates. -.TP -\fBMod1\fP + \fBa\fP / \fBMod1\fP + \fBs\fP +.It Sy Ctrl + k / Ctrl + j Select tab to the left / right. -.TP -\fBF2\fP / \fBF3\fP -Go backward and forward in current browser history. -.P -.SS "Main window \(em WebKit viewport focused" -.TP -\fBEscape\fP +.It Sy F2 / F3 +Go backward / forward in current browser history. +.El +.Ss Main window - WebKit viewport focused +.Bl -tag +.It Sy Escape Stop loading. -.TP -\fBMiddle mouse\fP +.It Sy Middle mouse Open the link under the pointer in a new window. -.TP -\fBBackward\fP / \fBforward\fP (mouse keys 8 and 9) -Same as \fBF2\fP and \fBF3\fP. -.TP -\fBMod1\fP + \fBScroll up\fP -.TQ -\fBCtrl\fP + \fBScroll up\fP -Increase zoom level of the current page. -.TP -\fBMod1\fP + \fBScroll down\fP -.TQ -\fBCtrl\fP + \fBScroll down\fP -Decrase zoom level of the current page. -.TP -\fBMod1\fP + \fBScroll horizontally\fP -.TQ -\fBCtrl\fP + \fBScroll horizontally\fP -Reset zoom to $\fBLARIZA_ZOOM\fP. -.P -.SS "Main window \(em location bar focused" -.TP -\fBEscape\fP +.It Sy Backward / forward Pq mouse keys 8 and 9 +Same as F2 and F3. +.It Sy Ctrl + Scroll up / down +Increase / decrease zoom level of the current page. +.It Sy Ctrl + Scroll horizontally +Reset zoom to +.Sy $LARIZA_ZOOM . +.El +.Ss Main window - location bar focused +.Bl -tag +.It Sy Escape Reset the content of the location bar to the current URI. -.TP -\fBReturn\fP +.It Sy Return Commit, i.e. begin searching or open the URI. -.P -.SS "Download manager" -.TP -\fBMod1\fP + \fBd\fP -.TQ -\fBMod1\fP + \fBq\fP -Close the download manager. Active downloads are never aborted. However, -if there are no more active downloads and no more browsing windows, then -the entire program will quit. -.\" -------------------------------------------------------------------- -.SH "DOWNLOAD MANAGER" -Open the download manager using the appropriate hotkey. A new window -listing your downloads will appear. Clicking on an item will remove it -from the list and \(em if needed \(em cancel the download. -.P -There's no file manager integration, nor does \fBlariza\fP delete, -overwrite or resume downloads. If a file already exists, it won't be -touched. Instead, the new file name will have a suffix such as \fB.1\fP, -\fB.2\fP, \fB.3\fP, and so on. -.\" -------------------------------------------------------------------- -.SH "USER-SUPPLIED JAVASCRIPT FILES" +.El +.Ss Download manager +.Bl -tag +.It Sy Ctrl + d , Ctrl + q +Close the download manager. Active downloads are never aborted. However, if +there are no more active downloads and no more browsing windows, then the entire +program will quit. +.Sh DOWNLOAD MANAGER +Open the download manager using the appropriate hotkey. A new window listing +your downloads will appear. Clicking on an item will remove it from the list +and - if needed - cancel the download. +.Pp +There's no file manager integration, nor does +.Nm +delete, overwrite or resume downloads. If a file already exists, it won't be +touched. Instead, the new file name will have a suffix such as +.Sy .1 , .2 , .3 , +and so on. +.Sh USER-SUPPLIED JAVASCRIPT FILES After a page has been successfully loaded, the directory -\fI~/.config\:/lariza\:/user-scripts\fP will be scanned and each file in -it ending with \fB.js\fP will be run as a JavaScript file in the context -of said page. -.P -During development, you will most likely want to run \fBlariza\fP with -$\fBLARIZA_ENABLE_CONSOLE_TO_STDOUT\fP enabled. -.P -\fBlariza\fP comes with the following scripts: -.TP -\fBhints.js\fP -Press \fBf\fP (open link in current window) or \fBF\fP (open in new -window) to activate link hints. After typing the characters for one of -them, press \fBEnter\fP to confirm. Press \fBEscape\fP to abort. -.P -Those bundled scripts are automatically installed on \fBmake install\fP. -To use them, though, make sure to link them to the directory mentioned -above. -.\" -------------------------------------------------------------------- -.SH "WEB EXTENSIONS" -On startup, WebKit checks \fI~/.config/lariza/web_extensions\fP for any -\fB.so\fP files. See -.UR http://\:blogs.igalia.com/\:carlosgc/\:2013/\:09/\:10/\:webkit2gtk-\:web-\:process-\:extensions/ -this blog post -.UE +.Pa ~/.config/lariza/user-scripts +will be scanned and each file in it ending with +.Dq .js +will be run as a JavaScript file in the context of said page. +.Pp +During development, you will most likely want to run +.Nm +with +.Sy $LARIZA_ENABLE_CONSOLE_TO_STDOUT +enabled. +.Pp +.Nm +comes with the following scripts: +.Bl -tag +.It Sy hints.js +Press +.Sy f +.Pq open link in current window +or +.Sy F +.Pq open in new window +to activate link hints. After typing the characters for one of them press +.Sy Return +to confirm. +Press +.Sy Escape +to abort. +.El +.Pp +Those bundled scripts are automatically installed on +.Sy make install . +To use them, though, make sure to link them to the directory mentioned above. +.Sh WEB EXTENSIONS +On startup, WebKit checks +.Pa ~/.config/lariza/web_extensions +for any +.Sy .so +files. See this blog post +.Lk http://blogs.igalia.com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/ for further information on these extensions. -.P -\fBlariza\fP comes with the following extensions: -.TP -\fBwe_adblock.so\fP +.Pp +.Nm +comes with the following extensions: +.Bl -tag +.It Sy we_adblock.so Generic adblock. Reads patterns from the file -\fI~/.config/lariza/adblock\fP. Each line can contain a regular -expression. These expressions match case-insensitive and partially, i.e. -\fB.*foo.*\fP is the same as \fB.*FOO.*\fP and you can use anchors like -\fB^https?://...\fP. Please refer to -.UR https://\:developer.\:gnome.\:org/\:glib/\:stable/\:glib-\:regex-\:syntax.html -the GLib reference -.UE -for more details. Lines starting with \fB#\fP are ignored. -.P +.Pa ~/.config/lariza/adblock . +Each line can contain a regular expression. These expressions match +case-insensitive and partially, i.e. +.Sy .*foo.* +is the same as +.Sy .*FOO.* +and you can use anchors like +.Sy ^https?://... . +Please refer to the GLib reference +.Lk https://developer.gnome.org/glib/stable/glib-regex-syntax.html +for more details. Lines starting with +.Sy # +are ignored. +.El Those bundled web extensions are automatically compiled when you run -\fBmake\fP and installed on \fBmake install\fP. To use them, though, -make sure to link them to the directory mentioned above. -.\" -------------------------------------------------------------------- -.SH "TRUSTED CERTIFICATES" -By default, \fBlariza\fP trusts whatever CAs are trusted by WebKit. If -you wish to trust additional certificates, such as self-signed -certificates, the first thing you should do is try to add the -appropriate CAs to your system-wide store. -.P -If you wish to add simple exceptions, you can grab the certificate and -store it in the directory \fI~/.config/lariza/certs\fP. The filename -must be equal to the hostname: -.P -\f(CW -.nf -\&$ echo | openssl s_client -connect foo.de:443 | openssl x509 >foo.de -.fi -\fP -.P -This tells \fBlariza\fP to trust the given certificate when connecting -to host \fBfoo.de\fP. -.P -You can reload these certificates at runtime by pressing the appropriate -hotkey. Note that removed certificates will be kept in memory until you -restart \fBlariza\fP. -.P -Note: This is NOT equal to certificate pinning. WebKit ignores -user-specified certificates if the server's certificate can be validated -by any system-wide CA. -.\" -------------------------------------------------------------------- -.SH "SEE ALSO" -.BR lariza (1). +.Sy make +and installed on +.Sy make install . +To use them, though, make sure to link them to the directory mentioned above. +.Sh TRUSTED CERTIFICATES +By default, +.Nm +trusts whatever CAs are trusted by WebKit. If you wish to trust additional +certificates, such as self-signed certificates, the first thing you should do is +try to add the appropriate CAs to your system-wide store. +.Pp +If you wish to add simple exceptions, you can grab the certificate and store it +in the directory +.Pa ~/.config/lariza/certs . +The filename must be equal to the hostname: +.Bd -literal -offset indent +$ echo | openssl s_client -connect foo.de:443 | openssl x504 > foo.de +.Ed +.Pp +This tells +.Nm +to trust the given certificate when connecting to host +.Sy foo.de . +.Pp +You can reload these certificates at runtime by pressing the appropriate hotkey. +Note that removed certificates will be kept in memory until you restart +.Nm . +.Pp +Note: This is NOT equal to certificate pinning. WebKit ignores user-specified +certificates if the server's certificate can be validated by any system-wide CA. +.Sh SEE ALSO +.Xr lariza 1 diff --git a/tools/install.sh b/tools/install.sh new file mode 100755 index 0000000..4641973 --- /dev/null +++ b/tools/install.sh @@ -0,0 +1,48 @@ +#!/bin/sh -e +# Portable install version that supports -D -m and -t +# We have our own extension flag -s for running sed on the given files while +# installing. +die() { printf '%s\n' "$@" >&2; exit 1;} +usage() { + die "usage: ${0##*/} [-D] [-m mode] [-s sedscript] source dest" \ + " or: ${0##*/} [-D] [-m mode] [-s sedscript] [-t dir] [source...]" +} + +sed='' +mkdirp='' +target='' +mode=0755 + +while getopts 'Dm:s:t:h' opt; do + case $opt in + D) mkdirp=1 ;; + s) sed=$OPTARG ;; + t) target=$OPTARG ;; + m) mode=$OPTARG ;; + *) usage + esac +done + +shift "$((OPTIND - 1))" + +if [ "$target" ]; then + [ "$mkdirp" ] || [ -d "$target" ] || die "$target doesn't exist" + mkdir -p "$target" + for arg; do + [ -d "$target/${arg##*/}" ] && die "$target/${arg##*/} is a directory" + if [ "$sed" ]; then + sed "$sed" < "$arg" > "$target/${arg##*/}" + else + cp "$arg" "$target" + fi + + chmod "$mode" "$target/${arg##*/}" + done +else + case "$2" in */*) [ "$mkdirp" ] || [ -d "${2%/*}" ] || die "${2%/*} doesn't exist" + mkdir -p "${2%/*}" + esac + [ -d "$2" ] && die "$2 is a directory" + if [ "$sed" ]; then sed "$sed" < "$1" > "$2"; else cp "$1" "$2"; fi + chmod "$mode" "$2" +fi |