module Dmlenu:sig
..end
Use it to build your own dmenu-like application.
type
conf = {
|
stdin : |
|
bottom : |
|
focus_foreground : |
|
focus_background : |
|
normal_foreground : |
|
normal_background : |
|
match_foreground : |
|
lines : |
|
window_background : |
val default_conf : conf
type
app_state = {
|
compl : |
|
prompt : |
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
Dmlenu.run
but returns the list of completed tokens.