Omnibar & i3 - shreve/omnibar GitHub Wiki

Omnibar was originally designed to be an Alfred replacement for Linux. The main value of Alfred is that there's a shortcut to bring up the searchbar, you perform your search, and the bar closes. This can be achieved easily using Omnibar with i3.

First, enable the scratchpad by adding shortcuts to toggle it. $mod+space is a nice shortcut for this purpose.

# ~/.config/i3/config
bindsym $mod+space scratchpad show

Now we need the omnibar to be inside the scratchpad. This can be done using the after_start event.

Omnibar.config do |omnibar|
  omnibar.events.after_start = lambda do |app|
    screen_width = 2560
    width = 1000

    script = 'i3-msg move scratchpad;' \
             'i3-msg scratchpad show;' \
             "i3-msg resize set #{width} 200;" \
             "i3-msg move window to position #{(screen_width - width) / 2} 200"

    `#{script}`
  end
end

This script moves the current terminal into the scratchpad, and shrinks and centers the window into a bar.

The only thing missing is the auto-close after a query is performed. To add this, simply add a function to the configuration file

# ~/.omnibar
Omnibar.configure do |omnibar|
  omnibar.events.after_perform = -> { `i3-msg scratchpad show` }
end

After a query is performed, the scratchpad will hide, and you can continue about your computing! :+1: