Skip to content

Third party integration

Piña Colada edited this page Jun 12, 2021 · 6 revisions

Piped input

buku waits until its input is closed when not started in a tty. For example, the following hangs:

$ cat | buku

This is the intended behavior as the primary reason behind supporting piped input is to add bookmarks with a keyboard shortcut. Third-party applications should explicitly close the input stream or use a wrapper script like the following one:

#!/bin/bash

echo $1 | buku -a

Fuzzy search

fzf can be used for as you type searching and opening of bookmarks. Multiple bookmarks can be selected with tab (enter to open). Install fzf and place this function in ~/.bashrc

fb() {
    # save newline separated string into an array
    mapfile -t website <<< "$(buku -p -f 5 | column -ts$'\t' | fzf --multi)"

    # open each website
    for i in "${website[@]}"; do
        index="$(echo "$i" | awk '{print $1}')"
        buku -p "$index"
        buku -o "$index"
    done
}

cmder integration (Windows)

cmder creates HOME variable in init.bat when it starts.

buku sets its database path according to existence of HOME variable, which is not defined by default on Windows. For using related projects like bukubrow, bukubrow-host the bookmark database should be in the standard path, which rely on non-presence of HOME variable in windows.

For using buku it's required to set HOME= in %cmder_root%/config/user_profile.cmd as was suggested by cmder developers.