Searching the Web With Speed of Thought Using Dmenu

If you are using i3wm, you already should be familiar with dmenu. We are going to use dmenu for input search queries and then instantly jump to the browser.

That's how it looks:


I wrote a small script for this:


QUERY=$(echo '' | dmenu -p "Search:" -fn "-xos4-terminus-medium-r-*-*-14-*" -b)
if [ -n "$QUERY" ]; then
  xdg-open "${URL}${QUERY}" 2> /dev/null
  exec i3-msg [class="^Firefox$"] focus

Let's see, what's happening here. First, we call dmenu with following arguments:

  • -p 'Search:' - use this string as prompt
  • -fn "-xos4-terminus-medium-r-*-*-14-* - use terminus font which also supports utf-8 chartacters
  • -b - dmenu appears at the bottom of the screen

Then we create a url for request, open it in the default browser via xdg-open and send i3wm signal to focus on specific window (in my case this is Firefox).

I bind this script to Alt+g (g stands for google) in i3wm config:

bindsym $mod+g exec --no-startup-id ~/.i3/

And that's how it works.

Paste into dmenu

  • C-y - paste from primary X selection
  • C-Y - paste from X clipboard

Finding window class of any application

Just run xprop | grep WM_CLASS and click on desired app.

Swap duckduckgo to Google

Change URL value in script:


Set default browser for xdg-open

Find your browser here:

ls /usr/share/applications

And then run:

xdg-settings set default-web-browser <your_browser>.desktop