From: Armaan Bhojwani Date: Sun, 6 Jun 2021 04:17:09 +0000 (-0400) Subject: Add config file and rewrite manuals in scdoc X-Git-Tag: v1.0.0~51 X-Git-Url: https://git.armaanb.net/?p=chorizo.git;a=commitdiff_plain;h=908c251c524b644ed7d436b59e04f480b375a4f7 Add config file and rewrite manuals in scdoc --- diff --git a/.gitignore b/.gitignore index ed9ac6c..c296e42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ lariza we_adblock.so -darkreader.js \ No newline at end of file +darkreader.js +*.1 +*.5 \ No newline at end of file diff --git a/Makefile b/Makefile index 34374ba..b664dc3 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,15 @@ datarootdir = $(prefix)/share mandir = $(datarootdir)/man/man1 datadir = $(prefix)/share -.PHONY: all clean uninstall install +.PHONY: man lariza we_adblock.so clean uninstall install -all: lariza we_adblock.so darkreader +all: man lariza we_adblock.so darkreader + +man: + for i in man1/*.scd; do \ + printf "SCDOC\t%s\n" $$i; \ + scdoc < $$i > $$(echo "$$i" | rev | cut -f 2- -d '.' | rev); \ + done lariza: browser.c $(CC) $(CFLAGS) $(LDFLAGS) \ @@ -28,20 +34,22 @@ we_adblock.so: we_adblock.c install: all mkdir -p $(DESTDIR)$(bindir) \ - $(DESTDIR)$(man1dir) \ + $(DESTDIR)$(mandir) \ $(DESTDIR)$(libdir)/lariza/web_extensions \ $(DESTDIR)$(datadir)/lariza/user-scripts cp lariza $(DESTDIR)$(bindir)/lariza cp we_adblock.so $(DESTDIR)$(libdir)/lariza/web_extensions/we_adblock.so - cp man1/* $(DESTDIR)$(man1dir)/ + cp man1/* $(DESTDIR)$(mandir)/ + cp lariza.ini $(DESTDIR)/etc/lariza.ini cp -r user-scripts/* $(DESTDIR)$(datadir)/lariza/user-scripts/ uninstall: rm -rf $(DESTDIR)$(bindir)/lariza \ $(DESTDIR)$(libdir)/lariza \ $(DESTDIR)$(man1dir)/lariza* \ - $(DESTDIR)$(datadir)/lariza + $(DESTDIR)$(datadir)/lariza \ + $(DESTDIR)/lariza.ini reinstall: uninstall install diff --git a/browser.c b/browser.c index 2b52642..b12a809 100644 --- a/browser.c +++ b/browser.c @@ -53,6 +53,8 @@ void run_user_scripts(WebKitWebView *); void search(gpointer, gint); void show_web_view(WebKitWebView *, gpointer); void trust_user_certs(WebKitWebContext *); +GKeyFile *get_ini(void); +GKeyFile *config; struct Client { @@ -86,17 +88,16 @@ gint clients = 0, downloads = 0; gboolean cooperative_alone = TRUE; gboolean cooperative_instances = TRUE; int cooperative_pipe_fp = 0; -gchar *download_dir = "/var/tmp"; -gboolean enable_console_to_stdout = FALSE; +gboolean enable_console_to_stdout; gchar *fifo_suffix = "main"; -gdouble global_zoom = 1.0; -gchar *history_file = NULL; -gchar *home_uri = "about:blank"; -gchar *search_text = NULL; -GtkPositionType tab_pos = GTK_POS_TOP; -gint tab_width_chars = 20; -gchar *user_agent = NULL; - +gdouble global_zoom; +gchar *download_dir; +gchar *history_file; +gchar *home_uri; +gchar *search_text; +gint tab_width_chars; +gchar *user_agent; +gboolean javascript_disabled; void client_destroy(GtkWidget *widget, gpointer data) @@ -149,6 +150,8 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show, c->web_view = webkit_web_view_new_with_related_view(related_wv); webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), global_zoom); + WebKitSettings *settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view)); + webkit_settings_set_enable_javascript(settings, !javascript_disabled); g_signal_connect(G_OBJECT(c->web_view), "notify::favicon", G_CALLBACK(changed_favicon), c); g_signal_connect(G_OBJECT(c->web_view), "notify::title", @@ -626,57 +629,44 @@ ensure_uri_scheme(const gchar *t) } void -grab_environment_configuration(void) +get_config(void) { const gchar *e; - e = g_getenv(__NAME_UPPERCASE__"_ACCEPTED_LANGUAGE"); - if (e != NULL) - accepted_language[0] = g_strdup(e); - - e = g_getenv(__NAME_UPPERCASE__"_DOWNLOAD_DIR"); - if (e != NULL) - download_dir = g_strdup(e); - - e = g_getenv(__NAME_UPPERCASE__"_ENABLE_CONSOLE_TO_STDOUT"); - if (e != NULL) - enable_console_to_stdout = TRUE; - e = g_getenv(__NAME_UPPERCASE__"_FIFO_SUFFIX"); if (e != NULL) fifo_suffix = g_strdup(e); - e = g_getenv(__NAME_UPPERCASE__"_HISTORY_FILE"); - if (e != NULL) - history_file = g_strdup(e); - - e = g_getenv(__NAME_UPPERCASE__"_HOME_URI"); - if (e != NULL) - home_uri = g_strdup(e); - - e = g_getenv(__NAME_UPPERCASE__"_TAB_POS"); - if (e != NULL) { - if (strcmp(e, "top") == 0) - tab_pos = GTK_POS_TOP; - if (strcmp(e, "right") == 0) - tab_pos = GTK_POS_RIGHT; - if (strcmp(e, "bottom") == 0) - tab_pos = GTK_POS_BOTTOM; - if (strcmp(e, "left") == 0) - tab_pos = GTK_POS_LEFT; + char *xdg_down = getenv("XDG_DOWNLOAD_DIR"); + download_dir = (xdg_down) ? xdg_down : "/var/tmp"; + + config = get_ini(); + accepted_language[0] = g_key_file_get_string(config, "browser", + "accepted_language", NULL); + history_file = g_key_file_get_string(config, "browser", "history_file", NULL); + home_uri = g_key_file_get_string(config, "browser", "homepage", NULL); + enable_console_to_stdout = g_key_file_get_boolean(config, "browser", + "console_to_stdout", NULL); + user_agent = g_key_file_get_string(config, "browser", "user_agent", NULL); + javascript_disabled = g_key_file_get_boolean(config, "browser", + "javascript_disabled", NULL); + char *input_cookie_policy = g_key_file_get_string(config, "browser", + "cookie_policy", NULL); + cookie_policy = WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY; + if (input_cookie_policy) { + if (strcmp(input_cookie_policy, "all") == 0) { + cookie_policy = WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS; + } else if (strcmp(input_cookie_policy, "none") == 0) { + cookie_policy = WEBKIT_COOKIE_POLICY_ACCEPT_NEVER; + } } - e = g_getenv(__NAME_UPPERCASE__"_TAB_WIDTH_CHARS"); - if (e != NULL) - tab_width_chars = atoi(e); - - e = g_getenv(__NAME_UPPERCASE__"_USER_AGENT"); - if (e != NULL) - user_agent = g_strdup(e); - - e = g_getenv(__NAME_UPPERCASE__"_ZOOM"); - if (e != NULL) - global_zoom = atof(e); + tab_width_chars = g_key_file_get_integer(config, "ui", "tab_width", NULL); + tab_width_chars = (tab_width_chars) ? tab_width_chars : 20; + global_zoom = g_key_file_get_double(config, "ui", "zoom_level", NULL); + global_zoom = (global_zoom) ? global_zoom : 1.0; + search_engine = g_key_file_get_string(config, "ui", "search_engine", NULL); + search_engine = (search_engine) ? search_engine : "https://duckduckgo.com?q="; } void @@ -826,7 +816,7 @@ init_default_web_context(void) trust_user_certs(wc); cm = webkit_web_context_get_cookie_manager(wc); - webkit_cookie_manager_set_accept_policy(cm, WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY); + webkit_cookie_manager_set_accept_policy(cm, cookie_policy); webkit_web_context_set_favicon_database_directory(wc, NULL); webkit_cookie_manager_set_persistent_storage(cm, @@ -881,6 +871,13 @@ search_init(struct Client *c, int direction) search(c, direction); } +int +def_key(char *key, unsigned int def) +{ + char *conf = g_key_file_get_string(config, "keybindings", key, NULL); + return (conf) ? gdk_keyval_from_name((conf) ? conf : NULL) : def; +} + gboolean key_common(GtkWidget *widget, GdkEvent *event, gpointer data) { @@ -890,77 +887,74 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data) if (event->type == GDK_KEY_PRESS) { if (((GdkEventKey *)event)->state & GDK_CONTROL_MASK) { - switch (((GdkEventKey *)event)->keyval) { - case GDK_KEY_q: // close window + WebKitSettings *settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view)); + gboolean js = webkit_settings_get_enable_javascript(settings); + int key = ((GdkEventKey *)event)->keyval; + if (def_key("close_tab", GDK_KEY_q) == key) { client_destroy(NULL, c); return TRUE; - case GDK_KEY_w: // new tab + } else if (def_key("new_tab", GDK_KEY_w) == key) { f = ensure_uri_scheme(home_uri); client_new(f, NULL, TRUE, TRUE); g_free(f); return TRUE; - case GDK_KEY_e: // reload + } else if (def_key("reload", GDK_KEY_e) == key) { webkit_web_view_reload_bypass_cache(WEBKIT_WEB_VIEW(c->web_view)); return TRUE; - case GDK_KEY_y: // download manager + } else if (def_key("download_manager", GDK_KEY_y) == key) { gtk_widget_show_all(dm.win); return TRUE; - case GDK_KEY_d: // initiate web search + } else if (def_key("web_search", GDK_KEY_d) == key) { gtk_widget_grab_focus(c->location); gtk_entry_set_text(GTK_ENTRY(c->location), "w/"); gtk_editable_set_position(GTK_EDITABLE(c->location), -1); return TRUE; - case GDK_KEY_s: // i-search forwards + } else if (def_key("search_forwards", GDK_KEY_s) == key) { search_init(c, 1); return TRUE; - case GDK_KEY_r: // i-search backwards + } else if (def_key("search_backwards", GDK_KEY_r) == key) { search_init(c, -1); return TRUE; - case GDK_KEY_t: // location + } else if (def_key("location", GDK_KEY_t) == key) { gtk_widget_grab_focus(c->location); gtk_entry_set_text(GTK_ENTRY(c->location), webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view))); return TRUE; - case GDK_KEY_u: // previous tab + } else if (def_key("previous_tab", GDK_KEY_u) == key) { gtk_notebook_prev_page(GTK_NOTEBOOK(mw.notebook)); return TRUE; - case GDK_KEY_i: // next tab + } else if (def_key("next_tab", GDK_KEY_i) == key) { gtk_notebook_next_page(GTK_NOTEBOOK(mw.notebook)); return TRUE; - case GDK_KEY_h: // back in history + } else if (def_key("history_back", GDK_KEY_h) == key) { webkit_web_view_go_back(WEBKIT_WEB_VIEW(c->web_view)); return TRUE; - case GDK_KEY_l: // forward in history + } else if (def_key("history_forwards", GDK_KEY_l) == key) { webkit_web_view_go_forward(WEBKIT_WEB_VIEW(c->web_view)); return TRUE; - case GDK_KEY_j: // scroll down + } else if (def_key("scroll_down", GDK_KEY_j) == key) { for (int i = 0; i < 2; i++) { event->key.keyval = GDK_KEY_Down; gdk_event_put(event); } return TRUE; - case GDK_KEY_k: // scroll up - for (int i = 0; i < 2; i++) { - event->key.keyval = GDK_KEY_Up; - gdk_event_put(event); - } + } else if (def_key("scroll_up", GDK_KEY_k) == key) { + event->key.keyval = GDK_KEY_Up; + gdk_event_put(event); return TRUE; - case GDK_KEY_f: // page down + } else if (def_key("scroll_page_down", GDK_KEY_f) == key) { event->key.keyval = GDK_KEY_Page_Down; gdk_event_put(event); return TRUE; - case GDK_KEY_b: // page up + } else if (def_key("scroll_page_up", GDK_KEY_b) == key) { event->key.keyval = GDK_KEY_Page_Up; gdk_event_put(event); return TRUE; - case GDK_KEY_o: // toggle JS - WebKitSettings *settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view)); - gboolean current = webkit_settings_get_enable_javascript(settings); - webkit_settings_set_enable_javascript(settings, - (current) ? FALSE : TRUE); + } else if (def_key("toggle_js", GDK_KEY_o) == key) { + webkit_settings_set_enable_javascript(settings, (js) ? FALSE : TRUE); webkit_web_view_set_settings(WEBKIT_WEB_VIEW(c->web_view), settings); return TRUE; - case GDK_KEY_g: // go to bottom + } else if (def_key("quit", GDK_KEY_g) == key) { search(c, 2); gtk_widget_grab_focus(c->web_view); gtk_entry_set_text(GTK_ENTRY(c->location), @@ -970,16 +964,17 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data) "document.activeElement.blur();", NULL, NULL, c); return TRUE; - case GDK_KEY_equal: // zoom in + } else if (def_key("zoom_in", GDK_KEY_equal) == key) { now = webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(c->web_view)); webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), now + 0.1); return TRUE; - case GDK_KEY_minus: // zoom out + } else if (def_key("zoom_out", GDK_KEY_minus) == key) { now = webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(c->web_view)); webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), now - 0.1); return TRUE; - case GDK_KEY_0: // reset zoom - webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), 1); + } else if (def_key("zoom_reset", GDK_KEY_0) == key) { + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), + global_zoom); return TRUE; } } @@ -992,9 +987,9 @@ key_downloadmanager(GtkWidget *widget, GdkEvent *event, gpointer data) { if (event->type == GDK_KEY_PRESS) { if (((GdkEventKey *)event)->state & GDK_CONTROL_MASK) { - switch (((GdkEventKey *)event)->keyval) { - case GDK_KEY_y: /* close window (left hand) */ - case GDK_KEY_q: + int key = ((GdkEventKey *)event)->keyval; + if ((def_key("close_tab", GDK_KEY_q) == key) || + (def_key("download_manager", GDK_KEY_y) == key)) { downloadmanager_delete(dm.win, NULL); return TRUE; } @@ -1015,9 +1010,8 @@ key_location(GtkWidget *widget, GdkEvent *event, gpointer data) return TRUE; if (event->type == GDK_KEY_PRESS) { - switch (((GdkEventKey *)event)->keyval) { - case GDK_KEY_KP_Enter: - case GDK_KEY_Return: + int key = ((GdkEventKey *)event)->keyval; + if ((GDK_KEY_KP_Enter == key) || (GDK_KEY_Return == key)) { gtk_widget_grab_focus(c->web_view); t = gtk_entry_get_text(GTK_ENTRY(c->location)); if (t != NULL && t[0] == 's' && t[1] == '/') { @@ -1026,7 +1020,7 @@ key_location(GtkWidget *widget, GdkEvent *event, gpointer data) search_text = g_strdup(t + 2); search(c, 0); } else if (t != NULL && t[0] == 'w' && t[1] == '/') { - const char *engine = "https://duckduckgo.com?q="; + const char *engine = search_engine; int len = strlen(engine) + strlen(t) - 2; char *f = (char *) malloc(len); snprintf(f, len + 1, "%s%s", engine, t + 2); @@ -1038,14 +1032,14 @@ key_location(GtkWidget *widget, GdkEvent *event, gpointer data) g_free(f); } return TRUE; - case GDK_KEY_Escape: + } else if ((GDK_KEY_Escape == key) || + (def_key("quit", GDK_KEY_g) == key)) { t = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)); gtk_entry_set_text(GTK_ENTRY(c->location), (t == NULL ? __NAME__ : t)); return TRUE; } } - return FALSE; } @@ -1132,7 +1126,6 @@ mainwindow_setup(void) mw.notebook = gtk_notebook_new(); gtk_notebook_set_scrollable(GTK_NOTEBOOK(mw.notebook), TRUE); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(mw.notebook), tab_pos); gtk_container_add(GTK_CONTAINER(mw.win), mw.notebook); g_signal_connect(G_OBJECT(mw.notebook), "switch-page", G_CALLBACK(notebook_switch_page), NULL); @@ -1265,13 +1258,34 @@ trust_user_certs(WebKitWebContext *wc) } } +GKeyFile * +get_ini(void) +{ + GKeyFileFlags flags = G_KEY_FILE_NONE; + g_autoptr(GError) error = NULL; + config = g_key_file_new(); + + // Load user config + if (!g_key_file_load_from_file(config, + g_build_filename(g_get_user_config_dir(), + __NAME__, "lariza.ini", + NULL), flags, &error)) { + // Load global config + if (!g_key_file_load_from_file(config, "/etc/lariza.ini", flags, + &error)) { + fprintf(stderr, "Could not load lariza.ini: %s", error->message); + } + } + return config; +} + int main(int argc, char **argv) { int opt, i; gtk_init(&argc, &argv); - grab_environment_configuration(); + get_config(); while ((opt = getopt(argc, argv, "C")) != -1) { switch (opt) { diff --git a/lariza.ini b/lariza.ini new file mode 100644 index 0000000..92d8572 --- /dev/null +++ b/lariza.ini @@ -0,0 +1,13 @@ +# lariza browser example configuration file. A full list of options +# can be found in lariza-config(5). + +# [browser] +# homepage=https://duckduckgo.com +# console_to_stdout=true + +# [ui] +# tab_width=25 +# zoom_level=1.25 + +# [keybindings] +# download_manager=m \ No newline at end of file diff --git a/man1/lariza-config.5.scd b/man1/lariza-config.5.scd new file mode 100644 index 0000000..0c435ec --- /dev/null +++ b/man1/lariza-config.5.scd @@ -0,0 +1,168 @@ +lariza-config(5) + +# NAME +_lariza.ini_ - configuration file for *lariza*(1) + +# DESCRIPTION +_lariza.ini_ is the system configuration file for the lariza browser. The syntax +is the standard GTK ini format. An example is provided at _/etc/lariza.ini_, and +user configuration should go in _~/.config/lariza/lariza.ini_, or your +equivalent as set by $XDG_CONFIG_DIR. Settings must go under the relevant +subsection. + +# OPTIONS +## BROWSER +*history_file*++ + Type: string++ + Default: none++ + File that lariza should save history to. + +*homepage*++ + Type: string++ + Default: none++ + Set the default URI for new tabs. + +*console_to_stdout*++ + Type: boolean++ + Default: false++ + Print the contents of the browser console to stdout. + +*user_agent*++ + Type: string++ + Default: the WebKit default++ + Choose a custom user agent. + +*javascript_disabled*++ + Type: boolean++ + Default: false++ + Determines whether or not JavaScript is enabled by default. + +*cookie_policy*++ + Type: string++ + Default: "no_third_party"++ + Options: "all", "none", "no_third_party"++ + Determines what cookies are accepted. + +*search_engine*++ + Type: string++ + Default: "https://duckduckgo.com?q="++ + What search engine to use when searching with "w/". + +## UI +*tab_width*++ + Type: integer++ + Default: 20++ + Width of each tab in characters. + +*zoom_level*++ + Type: double++ + Default: 1.0++ + Default zoom level of each page. + +## KEYBINDINGS +All of these keybindings are bound to Control + key. + +*close_tab*++ + Type: string++ + Default: q++ + Close the current tab. + +*new_tab*++ + Type: string++ + Default: w++ + Open a new tab. + +*reload*++ + Type: string++ + Default: e++ + Reload the current tab. + +*download_manager*++ + Type: string++ + Default: y++ + Toggle the download manager. + +*web_search*++ + Type: string++ + Default: d++ + Start a web search. + +*search_forwards*++ + Type: string++ + Default: s++ + Search in-page forwards. + +*search_backwards*++ + Type: string++ + Default: r++ + Search in-page backwareds. + +*location*++ + Type: string++ + Default: t++ + Select the URL. + +*previous_tab*++ + Type: string++ + Default: u++ + Focus the previous tab. + +*next_tab*++ + Type: string++ + Default: i++ + Focus the next tab. + +*history_forwards*++ + Type: string++ + Default: h++ + Go forwards in history. + +*history_back*++ + Type: string++ + Default: h++ + Go back in history. + +*scroll_down*++ + Type: string++ + Default: j++ + Scroll down one line. + +*scroll_up*++ + Type: string++ + Default: k++ + Scroll up one line. + +*scroll_page_down*++ + Type: string++ + Default: f++ + Scroll down one page. + +*scroll_page_up*++ + Type: string++ + Default: b++ + Scroll up one page. + +*toggle_js*++ + Type: string++ + Default: o++ + Toggle JavaScript. + +*quit*++ + Type: string++ + Default: g++ + Deselect everything and focus on the webpage. + +*zoom_in*++ + Type: string++ + Default: =++ + Zoom in 10%. + +*zoom_out*++ + Type: string++ + Default: -++ + Zoom out 10%. + +*zoom_reset*++ + Type: string++ + Default: -++ + Reset zoom to default. diff --git a/man1/lariza-usage.1 b/man1/lariza-usage.1 deleted file mode 100644 index d3a8c82..0000000 --- a/man1/lariza-usage.1 +++ /dev/null @@ -1,182 +0,0 @@ -.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" -These hotkeys work when either the location bar or the web view is being -focused. -.TP -\fBControl\fP + \fBq\fP -Close the current tab. Quits the entire program if this was the last -tab and if there are no more active downloads (download manager is -shown otherwise). -.TP -\fBControl\fP + \fBw\fP -Open a new tab. -.TP -\fBControl\fP + \fBe\fP -Reload the current page. -.TP -\fBControl\fP + \fBy\fP -Open the download manager. -.TP -\fBControl\fP + \fBd\fP -Initiate a web search. -.TP -\fBControl\fP + \fBt\fP -Focus the location bar. -.TP -\fBControl\fP + \fBs\fP / \fBControl\fP + \fBr\fP -Search forwards/backwards. -.TP -\fBControl\fP + \fBu\fP / \fBControl\fP + \fBi\fP -Select tab to the left / right. -.TP -\fBControl\fP + \fBh\fP / \fBControl\fP + \fBl\fP -Go backward and forward in current browser history. -.TP -\fBControl\fP + \fB=\fP / \fBControl\fP + \fB-\fP -Zoom in / out. -.TP -\fBControl\fP + \fB0\fP -Reset zoom. -.P -.SS "Main window \(em WebKit viewport focused" -.TP -\fBEscape\fP -Stop loading. -.TP -\fBMiddle mouse\fP -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 -\fBControl\fP + \fBScroll up\fP -.TQ -\fBCtrl\fP + \fBScroll up\fP -Increase zoom level of the current page. -.TP -\fBControl\fP + \fBScroll down\fP -.TQ -\fBCtrl\fP + \fBScroll down\fP -Decrase zoom level of the current page. -.TP -\fBControl\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 -Reset the content of the location bar to the current URI. -.TP -\fBReturn\fP -Commit, i.e. begin searching or open the URI. -.P -.SS "Download manager" -.TP -\fBControl\fP + \fBy\fP -.TQ -\fBControl\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" -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. -.TP -\fBprivacy-redirect.js\fP -Redirects YouTube, Reddit, etc to privacy respecting alternatives. -.TP -\fBdarkreader.js\fP -See https://darkreader.org. -.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 -for further information on these extensions. -.P -\fBlariza\fP comes with the following extensions: -.TP -\fBwe_adblock.so\fP -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 -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). diff --git a/man1/lariza-usage.1.scd b/man1/lariza-usage.1.scd new file mode 100644 index 0000000..cadf89d --- /dev/null +++ b/man1/lariza-usage.1.scd @@ -0,0 +1,81 @@ +lariza-usage(1) + +# NAME +lariza-usage - extended usage hints + +# DESCRIPTION +*lariza* is a simple web browser using GTK+ 3, GLib and WebKit2GTK+. This +manpage contains additional hints and pointers regarding its usage. + +# KEYBINDINGS AND CONFIGURATION +For this information, please refer to *lariza-configuration*(1). + +# 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. + +There's no file manager integration, nor does *lariza* 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 *.1*, *.2*, *.3*, and so on. + +# USER-SUPPLIED JAVASCRIPT FILES +After a page has been successfully loaded, the directory +_~/.config/lariza/user-scripts_ will be scanned and each file in it ending with +*.js* will be run as a JavaScript file in the context of said page. + +*lariza* comes with the following scripts: + +*hints.js* + Press *f* (open link in current window) or *F* (open in new window) to + activate link hints. After typing the characters for one of them, press + *Enter* to confirm. Press *Escape* to abort. + +*privacy-redirect.js* + Redirects YouTube, Reddit, etc to privacy respecting alternatives. + +*darkreader.js* + See https://darkreader.org. + +Those bundled scripts are automatically installed on *make install*. To use +them, though, make sure to link them to the directory mentioned above. + +# WEB EXTENSIONS +On startup, WebKit checks _~/.config/lariza/web_extensions_ for any *.so* +files. See + +this blog post for further information on these extensions. + +*lariza* comes with the following extensions: + +*we_adblock.so* + Generic adblock. Reads patterns from the file _~/.config/lariza/adblock_. Each + line can contain a regular expression. These expressions match + case-insensitive and partially, i.e.*\*foo.\** is the same as *.\*FOO.\** and + you can use anchors like *^https?://...*. Please refer to + https://developer.gnome.org/glib/stable/glib-regex-syntax.html the GLib + reference for more details. Lines starting with "#" are ignored. + + Those bundled web extensions are automatically compiled when you run *make* + and installed on *make install*. To use them, though, make sure to link them + to the directory mentioned above. + +# TRUSTED CERTIFICATES +By default, *lariza* 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. + +If you wish to add simple exceptions, you can grab the certificate and store it +in the directory _~/.config/lariza/certs_. The filename must be equal to the +hostname: + + $ echo | openssl s_client -connect foo.de:443 | openssl x509 >foo.de + +This tells *lariza* to trust the given certificate when connecting to host +*foo.de*. + +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. + +# SEE ALSO +*lariza*(1), *lariza-config*(1) diff --git a/man1/lariza.1 b/man1/lariza.1 deleted file mode 100644 index 648e5ce..0000000 --- a/man1/lariza.1 +++ /dev/null @@ -1,119 +0,0 @@ -.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 -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 -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 -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 -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 -Directory where trusted certificates are stored. See -\fBlariza-usage\fP(1). -.TP -\fI~/.config\:/lariza\:/user-scripts\fP -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). diff --git a/man1/lariza.1.scd b/man1/lariza.1.scd new file mode 100644 index 0000000..706446e --- /dev/null +++ b/man1/lariza.1.scd @@ -0,0 +1,68 @@ +lariza(1) + +# NAME +lariza - simple web browser + +# SYNOPSIS +*lariza* - [-C] [_URI ..._] + +# DESCRIPTION +*lariza* is a simple web browser using GTK+ 3, GLib and WebKit2GTK+. + +# OPTIONS +In addition to the standard arguments of GTK+ 3, *lariza* knows about the +following options: + +*-C* + Disables cooperative instances. + +After these options there can be any number of URIs specified to open. + +# ENVIRONMENT +In addition to the standard variables of GTK+ 3, *lariza* knows about the +following environment variable: + +*LARIZA_FIFO_SUFFIX* + 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 standards: /var/run/user/$UID/lariza.fifo-$LARIZA_FIFO_SUFFIX + + *$UID* is the id of your user. *$LARIZA_FIFO_SUFFIX* defaults to *main*. If you + change this variable, you can launch several independent cooperative instances + of *lariza*. + +# FILES +XDG variables will be used to construct these paths. +*~/.config/lariza/lariza.ini* + Configuration file. See *lariza-config*(5). + +*~/.config/lariza/adblock* + Adblock patterns. See *lariza-usage*(1). + +*~/.config/lariza/certs* + Directory where trusted certificates are stored. See *lariza-usage*(1). + +~/.config/lariza/user-scripts + Directory to store user-supplied JavaScript snippets. See *lariza-usage*(1). + +~/.local/share/lariza/web_extensions + Sets the directory where WebKit will look for web extensions. See + *lariza-usage*(1). + +~/.cache/lariza + +~/.cache/webkitgtk + +~/.local/share/webkitgtk + WebKitGTK will dump its caches and local storage here. It is probably wise to + clean those directories regularly or to mount them as *tmpfs*(5). + +# LICENSE +*lariza* is released under the MIT license. See the accompanying LICENSE file. + +# HISTORY +lariza was originally written by Peter Hofmann. The project was started in June +2014. This fork is maintained by Armaan Bhojwani. + +# SEE ALSO +*lariza-usage*(1), *lariza-config*(5)