Hello all!
I didn't thought it was so easy to extend `dmenu` but it seems it
is. So will just to fill in the context of this patch: yesterday I've
asked on the mailing list if there is a `dmenu` like replacement for
xmessage. (See the archive at:
http://lists.suckless.org/dev/1011/6486.html ) And I've received a lot
of feedback for which I thank to the posters.
Unfortunately none of the tools did what I needed... I figured out
that I actually need `dmenu` to be able to display some text message
(explaining the user what the input was for -- like a help message),
and just behave normally by letting the user select an item from the
list. (I think of it as a `dialog` replacement.) (I want to use it to
allow the user to confirm the actions of a background daemon, and the
message is longer than a single line.)
Thus I've made the following modifications to `dmenu`, which I
hereby place in the public domain (in the hope that it is going to be
accepted by the `dmenu` team and incorporated in the tool), and for
which I want to receive comments.
In summary, I've added two new arguments:
* `-of message-file` which gives the path to a file that contains
the message to be displayed; (it can be a pipe, nomal file, etc.);
* `-ol message-lines` which should limit the number of lines displayed;
I've also refactored the `readstdin` function which I've made to
delegate work to the `readfile` function, because I reuse it inside
the newly created function `readmsgfile`. (I've been careful to keep
inside `readstdin` the `inputw` computation and thus it is not
influenced by the `readmsgfile` function.)
Then I've added three new global variables: `msgfile`, `msglines`,
and `msgitems`, plus I've updated the `drawmenu` function (just before
the prompt) to include the drawing of the message lines.
(I've also added a sanity check to the `main` function to check if
the number of lines isn't negative, or if `-ol` was specified but not
`-of`.)
So any thoughts?
Ciprian.
This archive was generated by hypermail 2.2.0 : Wed Nov 24 2010 - 20:24:02 CET