Layerex/dmenu-bluetooth

[Feature request] Support for other dmenu compatible launchers

Closed this issue · 4 comments

hvitoi commented

Support for other launchers that support dmenu compatibility mode. Such as: Fuzzel, Wofi, Rofi, Bemenu and so on.

For instance. With fuzzel, the dmenu command should be replaced with fuzzel --dmenu

An example is networkmanager-dmenu which supports multiple dmenu backends

Any suggestions?

case "$DMENU_BLUETOOTH_LAUNCHER" in
rofi)
rofi -dmenu -i -p "$DMENU_BLUETOOTH_PROMPT" "${dmenu_args[@]}"
;;
fuzzel)
fuzzel --dmenu -i -p "$DMENU_BLUETOOTH_PROMPT" "${dmenu_args[@]}"
;;
*)
$DMENU_BLUETOOTH_LAUNCHER -i -p "$DMENU_BLUETOOTH_PROMPT" "${dmenu_args[@]}"
;;
esac

hvitoi commented

I like it!
However, I have a feeling that someone else is going to ask support for another xxx launcher.
What do you think about leaving the whole dmenu command to be specified by the user? (And making it a bit simpler)

For instance:

DMENU_COMMAND="${DMENU_COMMAND:-dmenu}"
run_dmenu() {
    $DMENU_COMMAND -i -p "$DMENU_BLUETOOTH_PROMPT" "${dmenu_args[@]}"
}
# Run with fuzzel
DMENU_COMMAND="fuzzel --dmenu" ./dmenu-bluetooth

# Run with rofi
DMENU_COMMAND="rofi -dmenu" ./dmenu-bluetooth

networkmanager-dmenu achieves it in a similar manner, but using a config file to specific the dmenu command. Example:

# ~/.config/networkmanager-dmenu/config.ini
[dmenu]
dmenu_command = fuzzel --dmenu
compact = true
wifi_chars = ▂▄▆█

[dmenu_passphrase]
obscure = True

However, I have a feeling that someone else is going to ask support for another xxx launcher.

I don't mind. Anyways, refactored this a bit.

networkmanager-dmenu supports individual launchers too.

However, I have a feeling that someone else is going to ask support for
another xxx launcher.

Case in point: I needed a minor tweak to make it work with tofi, removing
-i or -p flags.

By the way, would it be better to pass these via DMENU_ARGS or set them up in
the case block instead of hard-coding on the call, so that the
aforementioned tweak is obsolete?