/srch

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

srch.py

A power tool to choose which search engine to use for every search, quickly.

Searching for 'filter bubble' on Wikipedia

srch combines the web-searching power of bangs with the speed and ease of dmenu.

Features

  • high configurability
  • automatically sort search engines by number of times used (alphabetically on ties)

Dependencies

  • python3-xdg
  • dmenu is called by default, but rofi can be configured for use in its place.

Installing

  • place srch.py in your executable path
  • place srch.json in your XDG compatible config directory (most-likely $HOME/.config/ if you are unsure)

Configuring

Changes can be made to srch.json to change the dmenu calls, the enabled search engines, and the web browser to use.

Changing dmenu calls

In srch.json, the "search_menu" and "engine_menu" keys both describe dmenu calls. By default their values are "dmenu -p search" and "dmenu -p engine -i", respectfully. These can be modified like normal dmenu commands or replaced with rofi commands (in dmenu mode).

Changing the enabled search engines

The search engines shown to the user are stored as an object labeled "bangs". Key:values in "bangs" are of the form:

"A readable display name" : "some bang"

where "some bang" is a valid bang associated with a search engine e.g. !?, !g, !w, etc.

See this page for a list of supported search engines and their associated bangs.

Setting the default search engine

You can also set the first-most displayed search engine by setting the value of the "default" key to a key existing in the "bangs" object e.g. "default" : "DuckDuckGo" or "default" : "Google".

Changing the web browser

The web browser to use can be specified with the "browser" key. Its value by default is "xdg-open". To set firefox as the default browser, for example:

"browser" : "firefox"