lariza

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Lariza is a lightweight webkit2gtk browser, with low resource consumption, binary size and few dependencies. Lariza features tabbed browsing, custom user scripts, ad blocking and grep-like search functionality among other features. Furthermore, the user interface can be controlled entirely using keyboard shortcuts.

Installation

Lariza is available in the AUR as larizaAUR and lariza-gitAUR. Alternatively, source code is available on Uninformativ which can be built using make.

Configuration

Environment variables

Below is a list of environment variables you can export in your shell's rc file, accompanied by their default values.

LARIZA_ACCEPTED_LANGUAGE=en-US
LARIZA_DOWNLOAD_DIR=/var/tmp
LARIZA_ENABLE_CONSOLE_TO_STDOUT=
LARIZA_FIFO_SUFFIX=/var/run/user/$UID/lariza.fifo-$LARIZA_FIFO_SUFFIX
LARIZA_HISTORY_FILE=
LARIZA_HOME_URI=about:blank
LARIZA_TAB_POS=top
LARIZA_TAB_WIDTH_CHARS=20
LARIZA_USER_AGENT=
LARIZA_ZOOM=1.0
Tip: For further information about what these variables change and what their possible values are, see man lariza

Config files

Lariza can be further configured by modifying the following files:

$XDG_CONFIG_HOME/lariza/adblock
$XDG_CONFIG_HOME/lariza/certs
$XDG_CONFIG_HOME/lariza/scripts
$XDG_DATA_HOME/lariza/web_extensions
$XDG_CACHE_HOME/lariza
$XDG_CACHE_HOME/webkitgtk
$XDG_DATA_HOME/webkitgtk

Adblock

Support for blocking ads or URIs in general can be configured by creating $XDG_CONFIG_HOME/lariza/adblock with regular expressions. Case-insensitive regexp and partial matches with glob wildcards are supported.

.*/ad/.*
.*/ads/.*
^https?://ad.*
^https?://advert.*
^https?://.*\.advertising\.com/
Note: In versions <21.01, the adblock file is located in ~/.config/lariza/adblock.black

User Scripts

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.

Note: In versions <20.03, the scripts folder is located in ~/.config/lariza/scripts

Web Extensions

On startup, WebKit checks $XDG_CONFIG_HOME/lariza/web_extensions for any .so files. For more information see this blog post.

Trusted certificates

You can add your own _self-signed) certificates in $XDG_CONFIG_HOME/lariza/certs

Keybindings

Custom keybindings can be added (and existing ones can be modified) by changing the browser.c file.

Examples

  • You can change GDK_MOD1_MASK to GDK_CONTROL_MASK to change keybings using the ALt (Mod1) key to using Control.
  • A keybind containing the line
 webkit_settings_set_enable_javascript(webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view)), FALSE);

can be added to disable JavaScript.

Tip: When changing the default global modifier from Alt to Ctrl, make sure to change the keybind case GDK_KEY_c: /* reload trusted certs (left hand) */, to keep the clipboard copy shortcut Ctlr+c working.
Tip: The default MOD1+q (Close Window) and MOD1+w (Home) bindings can lead to unexpected window exits due to the proximity of the q and w keys to one another. Limit exposure to this by modifying GDK_KEY_q and/or GDK_KEY_w to suit.

Default key bindings

  • Mod1+q close window
  • Mod1+w home
  • Mod1+e new tab
  • Mod1+r reload
  • Mod1+d download manager
  • Mod1+2 search forward
  • Mod1+n search forward
  • Mod1+3 search backward
  • Mod1+l location
  • Mod1+k initiate search
  • Mod1+c reload trusted certs
  • Mod1+a go one tab to the left
  • Mod1+s go one tab to the right
  • F2 navigate forward
  • F3 navigate backward

Tips and Tricks

Speed Dial home page

You can create a static/dynamic HTML page with a list of links to serve as a Speed Dial page to be called with the home page key binding. See Lariza Speed Dial Example for a sample static page.

Note: Set the Lariza home page environment variable accordingly: LARIZA_HOME_URI=file:///home/example/.config/lariza/bookmarks.html

Disabling JavaScript

Lariza enables JavaScript by default by passes through the default configuration of the underlying webkit2gtk engine. Disabling JavaScript requires rebuilding webkit2gtk with the -DENABLE_JIT=OFF variable set.

Warning: This will effectively disable JavaScript across all applications which depend on webkit2gtk.

As mentioned earlier, the line

webkit_settings_set_enable_javascript(webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view)), FALSE);

can also be added to disable JavaScript. When doing this is recommended to also make keybindings to re-enable JavaScript when needed.

Using Lariza

lariza [-C] [URI ...]

  • Disable cooperative instances
$ lariza -C
  • Append Lariza with multiple URIs to open in separate tabs:
$ lariza archlinux.org duck.com example.org
  • Prepend Lariza with environment variables to switch the default cache and local storage locations to /dev/null:
$ XDG_CACHE_HOME=/dev/null XDG_DATA_HOME=/dev/null lariza
Note: This does not disable cache or local storage. Instead, cache and local storage data are retained within volatile memory and cleared upon application exit.
  • Improve upon the previous example by setting the configuration files directory to tmpfs and running the profile completely in memory:
$ XDG_CONFIG_HOME=/tmp XDG_CACHE_HOME=/dev/null XDG_DATA_HOME=/dev/null lariza
Note: XDG_CONFIG_HOME must mirror the file and directory structure of ~/.config whereby /tmp/lariza/keywordsearch is the equivalent of ~/.config/lariza/keywordsearch.
  • Set Lariza to launch within a firejail sandbox using a spectrwm window manager key binding:
# ~/.spectrwm.conf 

program[lariza] = firejail lariza -C
bind[lariza] = Mod+l

For complete documentation, review the latest README and man pages available on the Lariza project page.