#!/bin/sh # A custom dmenu for fast google searching and calling other web pages # # By default, the menu can only be initialized by executing this shell script. # To create a keyboard shortcut for it, copy it to your ~/.wmii-3.5/ directory # and change your wmiirc by adding # # Key $MODKEY-g # ~/.wmii-3.5/gmenu # # to the `eventstuff()` section of your wmiirc. # # Use the `$` character in the menu to prevent dmenu to autocomplete your input # to one of the specified options. It will filtered and not passed to the browser. # # To add more web pages as options, you need to add them to `WMII_MENU2 ...` line # (don't forget the newline character!) as well as the `case "$INPUT" in ... ` list. # set browser command BROWSER='firefox' set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS) WMII_MENU2="dmenu -b -p 'google: ' -fn '$WMII_FONT' -nf '$1' -nb '$2' -sf '$4' -sb '$5'" # options in the menu, seperated by `\n`s options() { echo -ne 'google\nwikipedia' } # run dmenu and remove any `$` character entered INPUT=`options | eval $WMII_MENU2 | tr -d '\$'` # exit if dmenu is left with `ESC` test "$INPUT" = "" && exit # do what was entered case "$INPUT" in google) eval $BROWSER "http://www.google.com" ;; wikipedia) eval $BROWSER "http://en.wikipedia.org" ;; *) eval $BROWSER "http://www.google.de/search?hl=de\&q=$INPUT" ;; esac exit