Termish[1] = ddgr
Feb 25, 2018
3 minute read

    What is the most common thing we do each day? We browse the internet using a search engine, from Google to DuckDuckGo.

    But what’s the process?

    Open the browser, fire up the search and wait for results; then take the mouse and click on it, or if there is some vim-like plugin installed, press f and wait for popups.

    It is too long for something we do so often, isn’t it?

    There are two different terminal utilities which improve this simple course of action, respectively for Google and DuckDuckGo : googler and ddgr.
    We are going to talk about the latter.

    Overview

    ddgr is a python3 script, ~1800 lines of code as of version 1.2, which take your query and show you the results. It doesn’t waste precious space on your screen: there are only your prompt and you.

    How it works

    There are two ways to call ddgr: with or without the search query as an argument. Both lead to the prompt, which is called omniprompt, where you can:

    • select an index to open a result
    • choose to open either in a text-based or GUI browser
    • go back and forth between the result pages
    • use DuckDuckGo bangs or site specific search

    If you call the utility without the search query, you'll need to insert it afterwards and you cannot take advantage of the various search options, like "I'm feeling Ducky" or time based search. However, this way it can be easily called from a window manager like i3/Sway:
    bindsym $mod+c exec alacritty -e ddgr
    

    But lets _ddgr_ talk for itself. Here's an asciinema:

    Features

    Quoting the exhaustive list of features from readme:

    • Fast and clean (no ads, stray URLs or clutter), custom color
    • Designed to deliver maximum readability at minimum space
    • Specify the number of search results to show per page
    • Navigate result pages from omniprompt, open URLs in browser
    • Search and option completion scripts for Bash, Zsh and Fish
    • DuckDuckGo Bang support (along with completion)
    • Open the first result directly in browser (as in I’m Feeling Ducky)
    • Non-stop searches: fire new searches at omniprompt without exiting
    • Keywords (e.g. filetype:mime, site:somesite.com) support
    • Limit search by time, specify region, disable safe search
    • HTTPS proxy support, Do Not Track set, optionally disable User Agent
    • Support custom url handler script or cmdline utility
    • Comprehensive documentation, man page with handy usage examples
    • Minimal dependencies

    Installation

    ddgr is available pretty much in every distro as shown here.

    Conclusion

    ddgr is really a must for people who use DuckDuckGo and want a clean terminal utility; it worked flawlessly for me in the past months, both in features and stability. Plus, it can encode the results in JSON format, making effortless the implementation in other scripts.




    Comments