sefr (Search Engine FRontend)

Terminal program for interactively opening search engines / parametric URLs.
It's kinda like surfraw but with interactive suggestions (via parsing opensearch json).

motivation

I use custom url bar search engines a lot, but browser support for them is frustrating.

e.g. in stock firefox, you can't create a search engine that, when you type "r foo" in your url bar, automatically goes to "reddit.com/r/foo". You have to manually write the URL, and you don't even get completions!

This is meant to be a customizable crossplat solution, and since it uses your default browser (details), I hope to fit it into my workflow with a global keybinding.

running

Clone it, install the Rust toolchain, and run cargo run in the directory.

You can also install it with cargo install sefr.

Keybindings are hardcoded right now, and they are:

config

Generates a TOML file in the the config dir provided by the directories crate (the usual ones, e.g. ~/.config/sefr/config.toml on linux). Should be pretty straightforward to add new search engines but sorry if I break the format between development versions.

You can leave out the prompt section when adding new engines and it'll use the default one. Also if you leave out the prompt text (or the entire prompt section) it'll display the engine's "name" parameter there.

So in that sense, the only required parameters for a new engine are:

The engine used when no prefix is entered is defined as _default in the config, and it is obligatory for the program to start.

So, minimal config.toml file:

toml [engines._default] name = "Google" search_url = "https://www.google.com/search?q=%s" suggestion_url = "https://www.google.com/complete/search?client=chrome&q=%s"

Fields are all strings except for colors (*_bg, *_fg). They can be strings (corresponding to the color names here), 8-bit numbers (corresponding to Ansi color codes), or 8-bit RGB tuples like [255,255,255]

The default config it generates is much less minimal, demonstrating prompt customization.

progress

Currently messy but it's working.