Cloudef / bemenu

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

fallback to shell execution #387

Closed LaptopDev closed 2 months ago

LaptopDev commented 4 months ago

Can bemenu execute user input through shell if user presses enter with no matches? I thought I was getting my alias to work before with bemenu but it's not now. alias thunderbird='flatpak run org.mozilla.Thunderbird'

Cloudef commented 4 months ago

https://github.com/Cloudef/bemenu/issues/272

LaptopDev commented 2 months ago

272

I don't think that's what I am asking. If it is, I couldn't see how based on the lack of examples in the linked issue.

Are you suggesting I use a wrapper for each and every alias command? That seems inappropriate. Maybe it would could make sense in some wrapper automation that sources the aliases. Is that what you suggest I do?

Cloudef commented 2 months ago

bemenu-run will not parse shell rc files, or add any sort of integration with the shell. However if you are fine with the input being piped to shell with no listing support then you can do something along:

bemenu-run --no-exec |  ${SHELL:-"/bin/sh"}

(Might need -l or -i flag for the SHELL for it to pick up your aliases)

LaptopDev commented 2 months ago

@Cloudef Would bemenu-run --no-exec | ${SHELL:-"/bin/sh"}

still allow partial matches to be executed?

CIAvash commented 2 months ago

It seems Shift+Return can be used for that

CIAvash commented 2 months ago

Shift+Return is the opposite of that, I think, executes the filter. Return executes the first result.

LaptopDev commented 2 months ago

not sure what shift return does... but I found cloudef's suggestion does work for me, executing partial matches, which I tested.

This is my new bind (hyprland): bind = $mainMod, p, exec, bemenu-run --binding vim --fn 'monospace 20' --no-exec | ${SHELL:-"/bin/sh"} -i

thanks for the help