RationaleBy The Lambda Church December 14, 2013
We are all users of dmenu, but we find that some features were underexploited, or completely missing :
- dmenu_run is a fine (shell) script, but since dmenu completes only in the list of candidates it took from stdin you can never have completion on program arguments.
- when you configure te window to span on several lines, candidates are now displayed one per line, nothing more. (to be fair, what else could there be?)
- A completion candidate is now a tuple instead of just a string.
The tuple consists of 3 strings, a "display" which is what will be shown to the user, a "real" which is what your application will retrieve once the completion is done, and a "doc" field (more on that later). An example for the interest display/real is the case of files: the display is the filename, the real is its absolute path.
- The candidate are not (only) coming from stdin anymore. Dmlenu is library, as such you can specify arbitrarly many sources, and transitions between them. You can also specify sources which run some kind of analysis on the current input to provide better candidates.
- As long as the user hasn't hit enter, the completion continues.
So once the user has "completed" an item (i.e. hit tab, or space
after a complete name) the "transition" function which we talked
about earlier will be called and provide a new source.
You can for example decide that if the input is "chrome" the new candidates will be your browsers bookmarks (display = bookmark name, real = url!)
- When the window spans on several lines, we also show a candidate (its display) per line, but also show the "doc" field. That's not much of an improvement, but we have some ideas for future development.
Oh and did I mention that dmlenu is a library?
You can in just a few line of codes design the application that better fits your needs : you can dynamically change the number of lines depending on the source, you can change the matching function (strict, fuzzy, you name it), etc.
It is developped in OCaml and available on Github (link in the