npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rofi-search

v1.0.0

Published

Interactive web search via rofi

Downloads

51

Readme

rofi-search

Interactive web search via rofi.
Multiple search engines supported.

Preview (click for large preview)

Installation

AUR package rofi-search-git

or npm install -g rofi-search

or copy rofi-search to your $PATH

Features

  • search as you type
  • Google search
  • DuckDuckGo search
  • I'm Feeling Lucky - Open the first result directly without waiting for the results to render
  • get top search results from multiple search engines
  • copy search result website url
  • open search result in web browser

Dependencies

  • nodejs >= 8.2.1
  • rofi-blocks (rofi-blocks-git package in AUR)
  • rofi
  • xclip copy to clipboard
  • googler (optional) google search results scraper
  • ddgr (optional) DuckDuckGo search results scraper

HOW TO RUN

Simply execute rofi-search in terminal (needs googler dependency to be installed).
Or see Usage section bellow for more advanced use cases.

Usage

You can choose between multiple methods of getting search results. Each one will give slightly different results.
You can even let rofi-search combine search results from multiple search engines.

  • Use googler for scraping Google for search results

    • googler does not parse information about number of search results so this information is not currently available when using this method
  • Use ddgr for scraping DuckDuckGo for search results

    • ddgr does not parse information about number of search results so this information is not currently available when using this method
  • Use google's custom search engine API by setting GOOGLE_API_KEY & GOOGLE_SEARCH_ID env variables

    • It can Search the entire web if you enable it in settings

    • You will need to go to https://cse.google.com/cse/all and create your own google custom search engine.

      • Get Search engine ID from the settings panel
        Preview
    • Get API KEY for the created search engine. Preview

Examples

Google CSE
export GOOGLE_API_KEY='google-api-key'
export GOOGLE_SEARCH_ID='google-search-engine-id'
export ROFI_SEARCH='cse'

rofi -modi blocks -blocks-wrap /absolute/path/to/rofi-search -show blocks \ 
-lines 4 -eh 4 -kb-custom-1 'Control+y' -theme /path/to/your/theme.rasi
googler
#for additional googler options see "googler --help"
export GOOGLE_ARGS='["--count", 5]'
export ROFI_SEARCH='googler'

rofi -modi blocks -blocks-wrap /absolute/path/to/rofi-search -show blocks \ 
-lines 4 -eh 4 -kb-custom-1 'Control+y' -theme /path/to/your/theme.rasi 
combine top free results from DuckDuckGo and Google
export DDG_ARGS='["-n", 3]'
export GOOGLE_ARGS='["--count", 3]'
export ROFI_SEARCH='googler,ddgr' #or 'cse,ddgr'

rofi -modi blocks -blocks-wrap /absolute/path/to/rofi-search -show blocks \ 
-lines 4 -eh 4 -kb-custom-1 'Control+y' -theme /path/to/your/theme.rasi

You can fetch rofi theme used in the gif preview HERE

Options

  • GOOGLE_API_KEY - secret key to access Google API. You can get it here
  • GOOGLE_SEARCH_ID - Your custom search engine (cse) ID
  • GOOGLE_ARGS - googler command line arguments. Serialized json array.
  • DDG_ARGS - ddgr command line arguments. Serialized json array.
  • ROFI_SEARCH - comma separated search methods
    • Supported methods: cse,googler,ddgr
    • If multiple methods are set, rofi-search will make multiple parallel searches and combine search results in the order search methods were defined
  • TITLE_COLOR - customize search result title color (default blue). This can't be set in rofi theme
  • ROFI_SEARCH_TIMEOUT - integer - delay between last character typed and automatic search execution (default 500ms)
  • ROFI_SEARCH_DEBUG - enables verbose logging if set to any value
  • ROFI_SEARCH_CMD - a command to execute when pressing -kb-accept-entry (enter) - defaults to xdg-open
    • example: export ROFI_SEARCH_CMD='google-chrome $URL'
supported rofi actions
  • -kb-accept-entry - open url with xdg-open (aka. your default browser)
  • -kb-accept-custom - open search results on google.com in your browser
  • -kb-custom-1 - copy url to clipboard

TODO (PR is welcome)

  • [x] ~~DuckDuckGO integration~~
  • [ ] make font sizes configurable
  • [ ] buku integration