Module Dmlenu

module Dmlenu: sig .. end
Main module of the library.

Use it to build your own dmenu-like application.



Configuration


type conf = {
   stdin : bool;
   bottom : bool;
   focus_foreground : string;
   focus_background : string;
   normal_foreground : string;
   normal_background : string;
   match_foreground : string;
   lines : int;
   window_background : string;
}
val default_conf : conf
type app_state = {
   compl : Completion.state;
   prompt : string;
}

Execution


val run : ?source_transition_hook:(Completion.state -> conf -> conf) ->
app_state -> conf -> string option
run initial_state conf creates the window and handles user inputs. Returns Some user_input when the user valid a completion (i.e. hits RET) or None when the user cancels (i.e. hits ESC)

N.B. this function is blocking.

The source_transition_hook parameter is to be used when you want to perform side effects, or update the configuration when a transition happens. The reason why you would want to use this hook instead of directly performing your computation in the transition function of the state machine (see Completion) is:


val run_list : ?source_transition_hook:(Completion.state -> conf -> conf) ->
app_state -> conf -> string list
Same as Dmlenu.run but returns the list of completed tokens.