sysid blog

twbm

Bookmarks are a major pillar of any knowledge-management strategy.

Bookmarks are the foundation of the World Wide Web and personal bookmark management should be regarded as a solved problem these days, right?

Truth is, I used to struggle a lot with bookmarks.

My requirements:

Well, there are myriads of bookmark managers out there, so just pick one, right?

However, bookmark managers tend to either suck you into a walled garden, or are not cross-platform or are blocked by some old-fashioned IT department for “security reasons”.

So I tried a lot of the existing solutions in order to have well maintained and synchronized bookmarks on all my devices.

Nothing worked for me, so eventually I wrote twbm.

twbm is heavily inspired by buku.

It allows managing bookmarks on the command line in a sqlite database via Github. Since I am living at the command line, opening a URL just by hitting a key is beautiful.

Over the time I found little griefs with buku so eventually I decided to fix things for me.

First things first: buku is great, it has a big community, and it is battle tested. I am grateful to jarun for providing and maintaining this useful tool.

However, I wanted a few things added or changed.

My wishlist

The UI is a matter of taste, but sometimes I struggled with buku’s parameter resolution and syntax.

Implementation

This is an extension of the idea of buku built on top of a few state-of-the python libraries for maintainability, enriched by the features I was missing.

The result twbm is still 100% buku compatible. Switching back and forth between twbm and buku is easily possible:

# upgrade existing buku database to twbm: 
twbm-upgrade-db.sh buku.db twbm.db

# downgrade twbm database back to buku:
twbm-downgrade-db.sh twbm.db buku.db

These commands are non-destructive, so no data will be lost.

The solution provides decent full text search based on sqlite’s FTS5.

Search Examples

# FTS examples (https://www.sqlite.org/fts5.htm)
twbm search 'security "single-page"'
twbm search '"https://securit" *'
twbm search '^security'
twbm search 'postgres OR sqlite'
twbm search 'security NOT keycloak'

# FTS combined with tag filtering
twbm search -t tag1,tag2 -n notag1 <searchquery>

# Match exact taglist
twbm search -e tag1,tag2

# Search -> select interactively -> pipe bookmark ids downstream for processing, e.g. adding tag 'x'
twbm search xxxxx | twbm update -t x

# Search by any tag and sort by bookmark age ascending
twbm search -T tag1,tag2 -O

Summary

I arrived at a point now where I truly regard bookmark management as solved for me.

Again, thanks buku for the inspiration.

#productivity #python