Cloudef / bemenu

Dynamic menu library and client program inspired by dmenu
GNU General Public License v3.0
1.16k stars 90 forks source link

Multi-Select Convenience #401

Open emrakyz opened 1 month ago

emrakyz commented 1 month ago

Better Behavior

  1. Multi-Select should jump to the next item automatically. This is the default behavior for fzf --multi.
  2. If the item is selected again, the item should be unselected. This is also the default for fzf --multi.

Steps to Reproduce

https://github.com/Cloudef/bemenu/assets/89175311/f82c075e-5cc9-4f2f-80a6-fbd271a4c18c

LaptopDev commented 2 weeks ago

@emrakyz Is your desire to output multiple selections from bemenu at a time?

edit: Currently multi-select requires you to manually select items piped into bemenu with control + enter , where your last selection is chosen by enter.

I can see how it would be a nice feature if the current multi-select selection could be dynamically shifted by shifting the selection in the list. One could, by shifting the selection during keying-down control + enter, expand the multi-select selection leftwards/rightwards or upwards/downwards. I would worry that preserving/recycling such keybind for this behavior would be inappropriate because 1) it would be too challenging, and 2) depending on the user's script to handle bemenu's output, may pose risk to data or security if the purpose is to delete or run code based off of output of bemenu.But it would make bemenu function like a dynamic batch processing front-end.

Earnestly commented 2 weeks ago

It means that when you press C-Return the cursor moves to the next item in the list.

LaptopDev commented 2 weeks ago

It means that when you press C-Return the cursor moves to the next item in the list.

If that's much different maybe I would want to create an issue for the behavior I describe.

emrakyz commented 2 weeks ago

@LaptopDev

Thanks for the message. You probably misunderstood. The problem is rather simple.

fzf --multi automatically goes to the next entry. This means you don't have to press the "down" arrow or if you use Vim bindings, the l key. When I press Tab the cursor goes to the next item without having to press anything other than Tab.

On the other hand, we have a similar feature for rofi -dmenu -multi-select. When you press Shift + Enter, the cursor goes to the next item immediately. So I can spam Shift + Enter to quickly select 10 different items. For instance, this is very useful for torrenting related scripts. I can select lots of files to increase/decrease their priority or disable downloading them.

For bemenu, in order to select that many items; you need to press CTRL + Enter and then the arrow keys. I think it's a simple convenience.

We can't undo the selections for bemenu either. Both fzf and rofi lets you unselect entries with the same keybindings.

LaptopDev commented 2 weeks ago

@emrakyz

I am new to this project and I did not realize we were unable to deselect items in bemenu. Seems like a no-brainer.

Expanding the selection in an automatic fashion to adjacent items is definitely something that would help to quickly define a potentially large multiple selection. To address the behavior you describe, it sounds like you just want Shift + Enter to shift the current item to the next, like rofi does and, with that, Control + Shift + Enter would automatically, then, select the current item and shift the current item to the next, allowing you to quickly add the next item just with Enter (since Control would already be down). Then you would simply lift the Control key up (Shift + Enter) in order to move over items.

I found this issue because I am interested in a dynamic multi-selection solution likened to this approach, but which required less key-binds.

Ideally I would like to be able to move between menu items with vim motions: hjkl and enter some vi-like visual selection mode for multi-selection where pressing some key would toggle the selection of the active cell/menu-item in a way that would allow deselecting it if pressed again, but also allow vim motions while the key was pressed to flip the selection state of whatever item shifted to. And Enter could still be used to finalize the selections, but would not include or exclude the item it is called on.