Soie Manual

A lightweight web engine and its browser

Soie is an HTML and CSS rendering engine written in C99 for old and small machines, from i486 to x86_64. It has no toolkit and no JavaScript in its core. It parses HTML as the WHATWG specification says and supports the CSS cascade, flexbox, grid, tables, SVG and web fonts. Extensions add cookies, content blocking, WebP images, JavaScript (QuickJS) and audio and video (FFmpeg and ALSA).

xsoie is the reference browser built on the engine. It is a plain Xlib program. Its address bar and its other bars are small HTML pages that Soie draws itself. It supports HTTPS, forms, history, cookies, scripts and video. This manual is mostly about xsoie. It also covers the other programs of the suite and has a short section for people who embed the engine. This manual describes Soie 0.1.11.

Install

On SliTaz the engine and its tools come in the soie package. The X11 browser is in xsoie, and it is the browser of the xsoie flavor. The GTK widget, gsoie and the translations are in soie-gtk.

# spk-add xsoie

The extensions are modules (.so files) installed in /usr/lib/soie/ext:

ModuleBrings
cookies.soThe cookie jar.
block.soContent blocking by host name.
webp.soWebP images.
script.soJavaScript (QuickJS).
media.soAudio and video (FFmpeg, ALSA). It is loaded only when a page first asks for audio or video.

The browser works without any extension: it then has no cookies, no scripts and no video. Fonts are found by scanning /usr/share/fonts, /usr/local/share/fonts, ~/.fonts and ~/.local/share/fonts. Fontconfig is not used.

The programs

ProgramWhat it is
xsoieThe browser on X11, with no toolkit. Menu entry: "Soie".
wsoieThe same browser on Wayland, when it was built. Menu entry: "Soie (Wayland)".
gsoieA small tabbed GTK 3 browser on SoieView, the Soie widget that Toile also uses.
soie-renderA command-line renderer: it shows the DOM, computed styles, the box tree, or writes a PNG image.

xsoie: start it

$ xsoie [-s] [-w WIDTH] [-H HEIGHT] [-o out.png] [URL]
URLThe page to open. Without it, xsoie opens the start page of about:settings, or about:soie when none is set.
-sScripts off for this window.
-w WIDTH, -H HEIGHTThe window size (default 1024x768).
-o out.pngNo window: load the page, wait for its resources and scripts, and write a PNG of the page area (the height less the 34 px toolbar). This mode uses the default settings, not yours.

Any other option prints the usage and exits with status 2. Examples:

$ xsoie https://www.slitaz.org/
$ xsoie -s /home/tux/notes.html
$ xsoie -w 1280 -H 800 -o slitaz.png https://www.slitaz.org/

Ctrl+N opens another window. Each window is a separate xsoie process, so a crash closes only one window. xsoie has no tabs.

The window

The page and the bars follow the desktop's dark or light theme (see Files and environment), unless the settings choose the colours. xsoie checks the theme again each time the window gets the focus. It uses MIT-SHM shared memory when the X server runs on the same machine. It works on 32, 24, 16 and 15-bit displays and on 8-bit colormaps. Its window class is xsoie, Xsoie. The xsoie interface is in English only.

Built-in pages: about:soie (home), about:settings, about:auth (logins) and about:blank.

The address bar

Ctrl+L, F6 or a click puts the focus in the address bar. The address is then selected, and the first key you type replaces it. Enter loads what you typed. Escape puts the current address back. The text you type is read this way:

with ://, or starting with about:Loaded as it is.
starting with /A local file. Its #, ? and % are part of the file name.
one word with a dot or a colon, or localhostOpened over https://.
anything elseA search. Soie uses the search URL of the settings, else $SOIE_SEARCH (a URL where %s stands for the words), else DuckDuckGo Lite.
/usr/share/doc/index.html       -> file:///usr/share/doc/index.html
hg.slitaz.org                   -> https://hg.slitaz.org
localhost:631                   -> https://localhost:631
slitaz iso                      -> a search

Keyboard and mouse

KeyAction
Ctrl+L, F6Address bar
Ctrl+NNew window on about:soie
Ctrl+Q, Ctrl+WClose the window
F5, Ctrl+RReload
Alt+Left, Alt+RightBack, forward
BackspaceBack, when no field has the focus
Ctrl+FFind bar
F3, Shift+F3Next, previous match
Ctrl+plus (or =), Ctrl+minusZoom in, out (10% a step)
Ctrl+0Zoom back to the settings' zoom
Ctrl+CCopy the focused address, the selection in a field, or the selected page text
Ctrl+XCut the selection of the focused page field
Ctrl+VPaste the clipboard
Shift+InsertPaste the primary selection
Ctrl+ASelect all the page text (in a field: all of the field)
Arrows Up and DownScroll by 40 px
Page Up, Page Down, SpaceScroll by a page
Home, EndTop, bottom of the page
F12Save the page for a bug report (see Debugging)
Ctrl+Shift+JRun the script file named by $SOIE_DEBUG_JS in the page

A page whose scripts take a key gets it first. With Ctrl, Alt or Meta, a key the page does not take goes to the browser shortcuts.

MouseAction
Left clickFollow a link, press a button, focus a field. A click on a video plays or pauses it.
Drag, double click, triple clickSelect text, a word, a block. Shift+click extends the selection. The selection becomes the primary selection.
Middle clickOn a link: open it in a new window. In a text field or the address bar: paste the primary selection.
WheelScroll 60 px a notch. The wheel scrolls the scrolling box under the pointer first (a frame, an element with overflow auto or scroll), then the page.
Buttons 8 and 9Back, forward

Links with target="_blank", and window.open() called after a click or a key, open a new window. Pop-ups that scripts open by themselves (from a timer, for example) are dropped.

Text, fields and lists

Text fields work as in other browsers. A click places the caret. Shift with the arrows, Home or End selects text. Ctrl with the arrows moves by words, and Ctrl+Backspace or Ctrl+Delete deletes a word. Typed or pasted text replaces the selection. In a textarea, Enter makes a new line and Up and Down move between the lines shown. In a one-line field, Enter sends the form. Escape takes the focus away from the field. Ctrl+C and Ctrl+X never copy a password.

A drop-down <select> opens a list of its options when you click it. Arrows, Home, End, Page Up and Page Down move in the list. Enter, Space, Tab, F4 or a click picks an option. Escape, or a click outside the list, closes it. Typed letters jump to the option that starts with them. When a select has the focus and its list is closed, the arrows and letters change its value at once, and Space, Enter, F4 or Alt+Down open the list.

Forms are sent as GET or POST (urlencoded). File upload is not supported.

Find in the page

Ctrl+F opens the find bar. The page is searched as you type, and the bar shows "n of m" or "not found". The current match is highlighted in orange and scrolled into view. Enter goes to the next match, Shift+Enter to the previous one, and Escape closes the bar. Case is ignored for ASCII letters. A match never spans two elements or two lines.

about:settings

The ⚙ button opens the settings page. You can also type about:settings in the address bar. Web pages can never open or post to this page. Save writes the settings to ~/.config/soie/settings ($XDG_CONFIG_HOME/soie/settings when that variable is set).

SettingKey and values
Start pagehome= a URL in http://, https://, file:/// or about:. Empty means about:soie.
Search withsearch= an http(s) URL with exactly one %s. Empty means $SOIE_SEARCH or DuckDuckGo Lite.
JavaScriptscripts= 1 (default) or 0
Colourscolors= system (default), light or dark
Zoomzoom= 30 to 300, in percent (default 100)
Cookiescookies= all, no-third-party (default) or none
Block the hosts of my listblock= 1 (default) or 0
Save files indownloads= an absolute folder. Empty means $XDG_DOWNLOAD_DIR or ~/Downloads.

The file holds one key=value per line, and # starts a comment. You may edit it by hand. Bad values are left out and the defaults stay in place.

# Soie's settings, written by about:settings
home=https://www.slitaz.org/
search=https://lite.duckduckgo.com/lite/?q=%s
scripts=1
cookies=no-third-party
colors=system
zoom=100
block=1
downloads=

The "Clear the cookies and logins" button forgets all cookies and HTTP logins. Scripts and cookie settings apply to the next pages loaded. Other windows read the settings when they open.

Downloads

Some files are not shown as pages: archives, ISO images, anything sent with Content-Disposition: attachment, and any type other than text, images, HTML, XML, JSON or JavaScript. These files are downloaded, and the page on screen stays where it is. The file goes to the settings' folder, else $XDG_DOWNLOAD_DIR, else ~/Downloads, which is created when needed. The file name comes from the server, else from the URL. A name already taken gets a number, for example file-1.iso. The body is written to a temporary file in ~/.cache/soie as it arrives, so a large ISO does not fill the RAM. The status line says "Downloading to ...", then "Saved to ..." or "Download failed: ...".

HTTP logins

When a page asks for an HTTP Basic login (the CUPS pages on localhost:631, a router), Soie shows about:auth with a user name and password form. On plain http to another machine, the page warns that the password travels unencrypted. A login is kept in memory until the browser closes and is sent to that server only. If the server refuses it, the form comes back. Cancel shows the server's own 401 page. Only Basic is supported: Digest and Kerberos are not.

Cookies, blocking and privacy

Requests send an Accept-Language header taken from your locale (LC_ALL, LC_MESSAGES, LANG).

Audio and video

Audio and video need media.so. A video starts only when you click it: autoplay is ignored, so a page full of videos stays light. Plain files (mp4, webm, ogg, mp3, wav, flac...) play directly. Streaming sites such as YouTube play through Media Source Extensions. Supported codecs are H.264, VP8, AAC, Opus, Vorbis, FLAC, MP3 and AC-3. VP9, AV1 and HEVC are refused, so sites fall back to H.264. Sound goes straight to ALSA, without PulseAudio. On a slow machine, video keeps time by dropping frames.

SOIE_AUDIO=nonePlay without sound.
SOIE_AUDIO=hw:0Use this ALSA device.

Iframes show their pages, but without scripts. An iframe is loaded only when it is scrolled into view.

Files and environment

FileUse
~/.config/soie/settingsSettings (about:settings)
~/.config/soie/block.txtBlock list
~/.local/share/soie/cookies.txtCookies
~/.local/share/soie/storage/localStorage
~/.cache/soie/Crash reports, busy.log, pages saved with F12, downloads in progress
~/DownloadsDownloaded files (default)
/usr/lib/soie/ext/Extensions
VariableEffect
SOIE_SEARCHSearch URL with %s, used when the settings set none.
SOIE_EXT_DIRLoad extensions from this folder. Without it, Soie uses the source tree's ext/ when run from the tree, else the installed ones.
SOIE_BLOCKBlock list file.
SOIE_STORAGElocalStorage folder; empty: memory only.
SOIE_COOKIESSet empty to keep cookies in memory only.
SOIE_AUDIOnone, or an ALSA device.
XDG_DOWNLOAD_DIRDownloads folder.
XDG_CONFIG_HOME, XDG_CACHE_HOMEBase folders for the settings and the cache.
GTK_THEMEA name containing "dark" makes pages dark. Without it, xsoie reads gtk-theme-name and gtk-application-prefer-dark-theme in the gtk-3.0 and gtk-4.0 settings.ini files: yours first, then the system's (/etc/xdg).
SOIE_DEBUG, SOIE_DEBUG_JS, ...See Debugging.

wsoie (Wayland)

$ wsoie [-s] [-w WIDTH] [-H HEIGHT] [-o out.png] [URL]

wsoie is the same browser on a Wayland compositor. It has the same bars, keys, settings and files as xsoie. The compositor draws the title bar. Keys use the compositor's keymap through xkbcommon, with dead keys and compose. The differences from xsoie: the clipboard works (Ctrl+C, Ctrl+V), but there is no primary selection, so a selection is not copied by itself and the middle button does not paste; and the window has no icon. Its menu entry is "Soie (Wayland)". It is hidden in LXDE and Openbox sessions, where xsoie is the one to use.

gsoie (GTK)

$ gsoie [URL...]

gsoie is a small GTK 3 browser with tabs, built on SoieView, the widget that Toile uses. Each URL on the command line opens a tab; without one it opens about:soie. The window has Back, Forward and Reload buttons, an address entry (URL, path or words to search for) and a status line. The status line shows the link under the pointer and the progress of downloads, which go to $XDG_DOWNLOAD_DIR or ~/Downloads. Script alerts open a dialog. gsoie has no about:settings.

Ctrl+TNew tab
Ctrl+WClose the tab (the window, on the last one)
Ctrl+QQuit
Ctrl+LAddress entry
Ctrl+R, F5Reload
Alt+Left, Alt+RightBack, forward
Ctrl+plus, Ctrl+minus, Ctrl+0Zoom in, out, 100%
Middle click, Ctrl+click on a linkOpen it in a new tab
Right clickMenu: Open Link in New Tab, Back, Forward, Reload, Copy, Copy Link Address, Copy Image Address, Paste

The context menu and the built-in pages (errors, login, downloads) follow your locale; French is the first translation. Pages follow the GTK theme, also when you switch it while gsoie runs. A tab behind another slows its scripts down to save CPU.

soie-render

$ soie-render [options] FILE|-

soie-render renders a local page (or standard input) without a window, for tests, scripts and screenshots. It reads only file:// resources; it never uses the network.

-dDump the DOM tree (default).
-c CHARSETCharset from the transport; skips charset detection.
-f CONTEXTParse as a fragment inside element CONTEXT.
-sScripting flag on (<noscript> as raw text).
-p PROPSDump these computed properties, comma separated.
-lDump the box tree with its geometry.
-o FILE.pngRender the viewport to a PNG. With -a, render the whole page (65536 rows at most).
-w WIDTH, -H HEIGHTViewport size (1024x768).
-Dprefers-color-scheme: dark.
-SStub font (every character 0.5em wide), as the tests use.
-b URLBase URL (default: the file's file:// URL).
-r DIRDocument root: file:///P reads DIR/P.
-jRun the page's scripts (and their timers, 2 s at most). Needs script.so.
-T MSTime given to the scripts, in milliseconds.
-x MODULELoad an extension module; may be repeated.
-XLoad the installed extensions.
-VPrint the library version.
$ soie-render page.html                        # the DOM
$ soie-render -p display,color,margin-top page.html
$ soie-render -l -w 800 page.html               # boxes
$ soie-render -o page.png -a page.html          # the whole page
$ soie-render -X -j page.html                   # with its scripts

Bug reports and debugging

SOIE_DEBUG=1On stderr: loads, HTTP status, failed resources, timings, script errors.
SOIE_DEBUG=2Also input, console.log, scripts' requests and the cache.
SOIE_DEBUG=3Also scrolling and painting.
SOIE_DEBUG_JS=file.jsScript run in the page with Ctrl+Shift+J. The file is read again each time.
SOIE_DEBUG_JS_START=file.jsScript run before the page's own scripts.
SOIE_DEBUG_PAINT=1Checks each partial redraw against a full one and reports differences.
$ SOIE_DEBUG=1 xsoie https://example.org/ 2>soie.log

Bugs and ideas: maille.slitaz.org/tags/soie.

Embedding the engine

The engine is libsoie (libsoie.so.0 and libsoie.a). Include <soie/soie.h> and build with pkg-config:

$ cc app.c $(pkg-config --cflags --libs soie)

The engine never opens a socket: the host gives it bytes through a fetch callback (soie_fetch_fn), which may answer SOIE_FETCH_LATER while the bytes are on their way. A typical program calls these functions:

For GTK 3, soie-gtk (libsoie-gtk.so.0, header soie-view.h) provides SoieView, a scrollable web view widget with an API modeled on WebKitWebView: soie_view_new(), soie_view_load_uri(), soie_view_go(), soie_view_register_uri_scheme(), the properties uri, title, loading and zoom-level, and the signals create, context-menu and download-started. Toile and gsoie are built on it. The ABI is not stable before 1.0 (extension ABI 0.3).

Known limits

About

Soie is free software under the BSD licence (2 clauses). Sources: hg.slitaz.org/soie, with a read-only git mirror at github.com/pankso/soie.