On Wed, Aug 30, 2023 at 6:13 AM Christopher Lang <[email protected]> wrote: > > Using <CRTL>+<RETURN>, multiple selections can be make in dmenu, each > outputting on a new line. If multiple selections are made in dmenu_run > then multiple lines will be piped to $SHELL which will not be properly > handled. > > This patch only pipes the last line of the output of dmenu to the shell. > In effect, the last or only program you selected is run. > > I think its quite unintuitive that dmenu can output multiple lines, but > I understand removing the feature may break some users' scripts. Perhaps > a command option could be added to dissable multiple output. > --- > dmenu_run | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/dmenu_run b/dmenu_run > index 834ede5..d6bbe5d 100755 > --- a/dmenu_run > +++ b/dmenu_run > @@ -1,2 +1,2 @@ > #!/bin/sh > -dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & > +dmenu_path | dmenu "$@" | tail -n 1 | ${SHELL:-"/bin/sh"} & > -- > 2.42.0
Hi Christopher, Personally I see little need for such a patch. I don't really think anyone is pressing <CTRL>+<RETURN> by mistake; they are nowhere near each other on most (all?) keyboard layouts. Actually I didn't even know about this feature despite using dmenu in a number of different scripts for many years. I'm already thinking of some use cases. All the best, Randy
