#!/bin/bash

# Source settings from .bemenurc
. ~/.config/bemenurc

title="Run:"
action=""

case $1 in
  -x)
    action="xway"
    title="Run through xwayland:";;
  -t)
    action="$TERMINAL"
    title="Run in terminal:";;
esac

program="$(compgen -c | sort -u | bemenu -p "$title" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")"

[ -n "$action" ] && $action "$program" && exit 0
$program