Re: [hackers] [dmenu][PATCH] Allow only one dmenu_run selection

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Wed, 30 Aug 2023 20:33:26 +0200

On Wed, Aug 30, 2023 at 11:25:18AM -0700, Jeremy wrote:
> On 08/30/23 05:41PM, Christopher Lang wrote:
> > This would be my implementation for executing all selected commands:
> >
> > #!/bin/sh
> > for x in $(dmenu_path | dmenu "$_AT_"); do
> > echo "$x" | ${SHELL:-"/bin/sh"} &
> > done
> >
> > I suppose this behaviour is more intuitive, but it is a little more
> > complicated. What are peoples preferences between original patch and
> > executing all commands?
> >
>
> The darker color on the "selected" items makes me think the blocking
> effect of the `$()` makes the most sense, with two exceptions:
> - the selected options are run in the same order as the input
> - each selected option is only run once
>
> Which would look like:
>
> #!/bin/sh
> t=$(mktemp)
> dmenu_path | tee "$t" | dmenu "$_AT_" | awk 'NR==FNR { x[$0]++; next } x[$0]' - "$t" | sh -x
>
> Jeremy
>

If this route is taken I think it would make more sense to not print the lines
directly when CTRL-Enter is used to select multiple lines.
And flush all selected lines on output.

This would make sense for dmenu_run but not some existing scripts that use it.

-- 
Kind regards,
Hiltjo
Received on Wed Aug 30 2023 - 20:33:26 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 30 2023 - 20:36:52 CEST