A small EPUB reader for the Kobo Clara BW, written in Rust. It runs instead of Kobo's own software (Nickel) while you read, draws straight to the e-ink framebuffer, and hands the device back to Nickel when you exit.
Folio is a personal work in progress. It supports one device, one book format and one way of laying out text. Read Risks before putting it on a device you care about.
| Library | Reader | Reader menu |
|---|---|---|
![]() |
![]() |
![]() |
| Contents | Text settings | Sleep screen |
![]() |
![]() |
![]() |
Screenshots are rendered on a computer with --png at the device's
1072×1448 resolution, using sample books made from public-domain text.
- Library. Scans the whole user partition for
.epubfiles and shows "Continue reading", recent books, then every book A–Z by author, with reading progress. - Reader. Paginated text with page turns by tap or swipe, a table of contents, and a reading position that survives font and size changes.
- Text settings. Font family, size, line spacing. Nine font families ship with it, plus one built into the binary.
- Frontlight. Brightness, and warmth on hardware that has it.
- Sleep. Power button, sleep cover, or an idle timeout suspend the device. After three hours asleep it powers off.
- USB transfer. Exports the user partition to a computer as a USB drive without leaving Folio.
- Hot reload. A new build copied over USB starts by itself when you eject.
- Boot into Folio (optional). A patch to the Kobo start-up script that starts Folio instead of Nickel, with several ways back.
- Only
.epub..kepub.epubfiles are skipped on purpose. No PDF, no DRM. - No images, SVG, MathML, hyperlinks or footnote pop-ups. Tables become text
with
|between cells. - Text is left-aligned and ragged-right: no justification, no hyphenation.
- Book CSS is read only for italic, bold, centring and "larger than body", and the last two only help detect headings. Fonts embedded in a book are not used.
- Books must be UTF-8. Other encodings show replacement characters.
- Heading detection for books that mark titles as plain paragraphs uses English keywords ("Chapter", "Part", …).
- No Wi-Fi. Folio turns the radio off and never uses the network.
- No dictionary, search, highlights, notes or bookmarks.
- Only the Kobo Clara BW (
spaBW, platformmt8113t-ntx). Device paths are hard-coded.
The last commit on main builds and its tests pass. The working tree is
ahead of it: uncommitted work adds a shared menu panel, a generated ASCII-art
sleep screen and a per-book cover picker. The screenshots and the usage notes
below show that newer interface. A book's own cover image is not shown.
Device
- Kobo Clara BW. The boot patch was written against firmware 4.41.23145.
- NickelMenu installed. Folio is started
from a NickelMenu entry, and the deploy script expects
.adds/nm/to exist.
Computer
-
Rust through
rustup, with the ARM target:rustup target add armv7-unknown-linux-musleabihf
The linker is
rust-lld, which ships with Rust, so no ARM cross-compiler is needed. -
deploy.shassumes macOS: the Kobo mounted at/Volumes/KOBOeReaderand Homebrew'srustup. On another system, copy the same files by hand.
-
Plug the Kobo into the computer and choose to connect, so it mounts as
KOBOeReader. -
Run:
./deploy.sh
This builds the release binary and copies it, the launcher scripts, the boot scripts, the fonts and the NickelMenu entry to the device.
-
Eject the Kobo.
-
Open the NickelMenu menu on the Kobo and choose Folio.
To update later, open USB transfer from Folio's library menu, run
./deploy.sh, and eject. Folio restarts into the new build by itself.
To uninstall, delete .adds/folio/ and .adds/nm/folio from the device. If
you installed the boot patch, remove it first (see
docs/device.md).
Everything lives on the user partition (/mnt/onboard on the device, the
KOBOeReader volume on a computer):
| Path | What |
|---|---|
.adds/folio/folio |
The program |
.adds/folio/folio.sh |
Launcher |
.adds/folio/nickel.sh |
Starts Kobo's software again |
.adds/folio/usb-enable.sh, usb-disable.sh |
USB transfer |
.adds/folio/boot/ |
Boot gate, installer, uninstaller |
.adds/folio/fonts/<Family>/ |
Reading fonts |
.adds/folio/settings.tsv |
Settings |
.adds/folio/state.tsv |
Reading position per book |
.adds/folio/library.tsv |
Cache of book titles and authors |
.adds/folio/folio.log, folio.old.log |
Log (rotated at 256 KiB) |
.adds/nm/folio |
NickelMenu entry |
Books can be anywhere on the partition. Folders and files whose names start with a dot are skipped.
| Action | Result |
|---|---|
| Tap a book | Open it |
| Swipe left or up, or tap the right half of the footer | Next page |
| Swipe right or down, or tap the left half of the footer | Previous page |
| Tap the menu icon, top right | Open the menu |
The menu has the frontlight controls and three buttons: Aa Text, USB transfer and Exit (labelled Kobo when Folio was started at boot). Exit returns to Kobo's software.
| Action | Result |
|---|---|
| Tap the right two thirds of the page, or swipe left | Next page |
| Tap the left third, or swipe right | Previous page |
| Tap the top strip of the screen | Open the menu |
| Tap below the open menu, or swipe up or down | Close the menu |
The menu shows the book title, the current chapter, page and percentage, the frontlight controls, and ‹ Library, Contents, Aa Text and Cover (choose the sleep-screen art for this book).
| Setting | Range | Default |
|---|---|---|
| Size | 28–60 px, steps of 2 | 40 |
| Spacing (line height) | 1.20–1.80, steps of 0.05 | 1.45 |
| Auto sleep | Off, 5, 10, 15, 30 min | 5 min |
| Font | Any installed family | Libertinus Serif (built in) |
A font choice takes effect when you tap Done.
Two settings have no screen and are changed by editing settings.tsv
(key<TAB>value, one per line):
| Key | Meaning | Default |
|---|---|---|
power_off_min |
Minutes asleep before powering off; 0 is never |
180 |
footer_clock |
1 shows the time at the bottom of the page |
0 |
A font family is a folder in .adds/folio/fonts/ holding Regular, Italic,
Bold and BoldItalic as .ttf or .otf. The folder name is the name shown
in the list. Add your own the same way. Shipped families: Atkinson
Hyperlegible Next, Bitter, Charis SIL, Gentium Book Plus, Libron, Literata,
Literata 7pt, Source Serif 4 and Sourcerer.
- The power button or closing a sleep cover puts the device to sleep. The power button or opening the cover wakes it.
- While charging, Folio shows the sleep screen with the light off but does not suspend, because suspending on external power hangs this device's kernel.
- After
power_off_minminutes asleep the device powers off and shows "Powered off / Hold the power button to start".
Plugging into a computer shows a prompt: Transfer files or Just charge. You can also open it from the library menu. In transfer mode the user partition is unmounted on the device and exported as a USB drive. To finish, eject on the computer and unplug, or tap Disconnect. Folio then checks the file system, remounts it and rescans the library.
Eject before unplugging. Both sides must not write to the partition at once.
Folio runs on a computer with a fake display, scripted input and fake
hardware. cargo host is an alias for
cargo run --target aarch64-apple-darwin -- (Apple Silicon; change the alias
in .cargo/config.toml for another host).
Render frames to PNG files:
cargo host --png out --root ~/Books --state-dir /tmp/folio-state \
--fonts-dir device/fonts --script "tap:536,400;next:3;tap:500,60"Each screen update writes out/frame-NNN.png (1072×1448). When the script
runs out, Folio quits.
| Flag | Meaning |
|---|---|
--root <dir> |
Folder scanned for books. Default /mnt/onboard |
--state-dir <dir> |
Settings, positions, cache. Default: next to the binary |
--fonts-dir <dir> |
Folder of font families. Default: fonts next to the binary |
--font-dir <dir> |
Use this one family for this run |
--book <path> |
Open this book directly |
--png <dir> |
Host mode, write each frame as a PNG |
--no-png |
Host mode, discard frames |
--script "<events>" |
Scripted input for host mode |
--fake-usb-fail |
Host mode: make USB transfer fail |
--boot |
Started at boot: a held finger exits to Kobo |
--reloaded |
Restarted after a hot reload: skip the held-finger check |
--dump-toc <epub> |
Print the table of contents and heading analysis, then exit |
Script events are separated by ;: tap:X,Y, swipeleft, swiperight,
swipeup, swipedown, power, coverclose, coveropen, tick, quit,
next:N (N next-page taps), usbplug, usbunplug, usbeject. With
--boot, a first event of hold simulates a finger held at start-up.
Host-only environment variables: FOLIO_FAKE_BATTERY (NN, NNc for
charging, -- for unreadable) and FOLIO_FAKE_SLEEP_SECS (seconds the fake
clock advances on each suspend).
Exit codes: 0 normal, 1 fatal error, 42 finger held at boot, 43
restart into a new build, 44 power the device off.
The default build target is ARM, so name the host target:
cargo test --target aarch64-apple-darwin
sh tests/boot_patch_test.shThe Rust tests cover EPUB parsing, heading detection, layout, settings, state, the power state machine, the USB flow, and whole-app runs driven by scripts. The shell test runs the boot installer and uninstaller against a copy of the real Kobo start-up script in a scratch folder.
| Path | What |
|---|---|
src/main.rs |
Arguments, backend selection |
src/app.rs |
Event loop, view switching, boot health marker |
src/ui.rs, src/menu.rs |
Shared drawing helpers, the View trait, the menu panel |
src/*_view.rs |
Library, reader, contents, settings and USB screens |
src/epub/ |
EPUB container, XHTML to blocks, heading detection |
src/doc.rs, src/text.rs |
Document model, line breaking and pagination |
src/gfx.rs |
Grayscale canvas, fonts, glyph cache |
src/ascii_cover.rs, src/covers.rs, src/cover_view.rs |
Generated sleep-screen art and its picker |
src/library.rs, src/settings.rs, src/state.rs |
Book scan and the three .tsv files |
src/power.rs |
Sleep, wake, power-off |
src/usb.rs, src/usb_flow.rs |
USB transfer |
src/display/, src/input/, src/hw/ |
Device and host backends |
device/ |
Scripts and fonts copied to the Kobo |
tests/ |
Integration tests and fixtures |
More detail:
- docs/architecture.md: how the program is put together.
- docs/device.md: launch, boot patch, power and USB on the Kobo.
- Folio replaces Nickel while it runs. The launcher stops Kobo's software and turns Wi-Fi off. Every exit from Folio, including a crash, restarts Nickel. A hang does not: the launcher's watchdog is switched off, so hold the power button to force the device off.
- Nothing outside
.adds/is changed unless you install the boot patch. - The boot patch edits a system file (
/etc/init.d/rcS) on the root partition. It refuses to install on any other model or on a start-up script it does not recognise, keeps two copies of the original, and falls back to Kobo's software on any doubt. Ways back, in order of effort:- Hold a finger on the screen while the device starts.
- Create an empty file
.adds/folio/boot-stockover USB. - Create an empty file
.adds/folio/uninstall-bootand start Folio from the menu. - Copy
.adds/folio/boot-backup/KoboRoot.tgzto.kobo/KoboRoot.tgzand restart; Kobo's own updater restores the original script.
- USB transfer unmounts the user partition. Eject on the computer before unplugging.
- Some USB details are guesses marked
GUESSin the scripts, and may behave differently on other firmware versions.
The suspend, Wi-Fi and USB sequences follow those in KOReader and Plato; the touch mapping follows FBInk's device table.
Folio's own code is released under the MIT License.
Fonts are not covered by it. Each family keeps its own licence, included
beside it in assets/ and device/fonts/ (mostly the SIL Open Font License).





