Hi there,
I wanted a menu that would allow me to select entries both from the
uzbl history and from google suggest 'as you type' (like in firefox).
While dmenu allows selecting entries in a static list (like uzbl
history) easily, modifying this list and providing hints to google
suggest did not seem to be possible. Since I did not see any other way
to do that, I wrote a patch to dmenu. It adds 2 features:
1) if invoked with the option -s (-s for stream) dmenu will output
selected entry on every keystroke (so you can feed a tool with the
current entry).
2) in order to avoid waiting for the input stream to finish before
allowing the user for select entries (and so that you can continue
feeding it from stdin while you type), dmenu reads stdin in a thread.
The idea is to feed dmenu with hints deduced from its stdout. As an
example, here is how this can be used:
#!/bin/bash
socat UNIX-LISTEN:/tmp/dmenu_suggest - | dmenu -s | tee /tmp/results | \
while read line; do echo $line | ./google_suggest; done | \
socat - UNIX-CONNECT:/tmp/dmenu_suggest
tail -n1 /tmp/results && rm /tmp/results
google_suggest is a python script I wrote. It reads search terms from
stdin and outputs suggestions from google suggest API (I have attached
it).
If you are interested, you can pull my dmenu patch from
https://bitbucket.org/chmduquesne/dmenu. Although the script above
works correctly on my machine, the patch breaks dmenu in other
situations. I would be interested if the persons who find this idea
interesting would be kind enough to provide some constructive advices
about the way to do that, e.g. if you see any cleaner method or if you
have suggestions for doing that in a better way without patching
dmenu. Advices like "don't do that" or "stop rewriting firefox" will
probably not help.
This archive was generated by hypermail 2.2.0 : Fri Nov 26 2010 - 14:48:02 CET