91 lines
1.7 KiB
Bash
Executable file
91 lines
1.7 KiB
Bash
Executable file
#!/bin/sh
|
|
# Script for using either bemenu or dmenu
|
|
# with preconfigured options
|
|
PROMPT="$1" ; MODE="$2"
|
|
|
|
# Configuration
|
|
MENU="fzf" # Default to fzf
|
|
col_nb="#121212" # Normal background
|
|
col_nf="#665c54" # Normal foreground
|
|
col_sb="#d3869b" # Selected background
|
|
col_sf="#121212" # Selected foreground
|
|
font="JetbrainsMono"
|
|
font_size="10"
|
|
|
|
[ -e "$HOME/.config/menu-config" ] && MENU="$(cat "$HOME/.config/menu-config")"
|
|
|
|
# Print help
|
|
if [ "$PROMPT" = "" -o "$PROMPT" = "-h" ] ; then
|
|
printf "Usage: menu [prompt] [run/pass/empty]"
|
|
return 0
|
|
fi
|
|
|
|
# Check for 'pass' arg
|
|
[ "$MODE" = "pass" ] &&
|
|
BPASS="-x" && DPASS="-P"
|
|
|
|
# bemenu opts
|
|
BEMENU_OPTS=" \
|
|
-c \
|
|
-i \
|
|
-l 10 \
|
|
-M 5 \
|
|
-W 0.3 \
|
|
-B 2 \
|
|
--cw 2 \
|
|
--tb $col_sb \
|
|
--tf $col_sf \
|
|
--fb $col_nb \
|
|
--ff $col_nf \
|
|
--cb $col_nb \
|
|
--cf $col_nf \
|
|
--nb $col_nb \
|
|
--nf $col_nf \
|
|
--hb $col_sb \
|
|
--hf $col_sf \
|
|
--ab $col_nb \
|
|
--af $col_nf \
|
|
--bdr $col_sb \
|
|
--fn "$font" \
|
|
-p "$PROMPT" \
|
|
$BPASS \
|
|
"
|
|
|
|
# dmenu opts
|
|
DMENU_OPTS=" \
|
|
-i \
|
|
-l 10 \
|
|
-nb $col_nb \
|
|
-nf $col_nf \
|
|
-sb $col_sb \
|
|
-sf $col_sf \
|
|
-fn "$font:size=$font_size" \
|
|
-p "$PROMPT" \
|
|
$DPASS \
|
|
"
|
|
|
|
# dmenu opts
|
|
FZF_OPTS=" \
|
|
--cycle \
|
|
--reverse \
|
|
"
|
|
|
|
# If chosen bemenu, use this args
|
|
[ "$MENU" = "bemenu" ] &&
|
|
OPTS="$BEMENU_OPTS" &&
|
|
RUN="-run"
|
|
|
|
# If chosen dmenu, use this args
|
|
[ "$MENU" = "dmenu" ] &&
|
|
OPTS="$DMENU_OPTS" &&
|
|
RUN="_run"
|
|
|
|
# If chosen fzf, use this args
|
|
[ "$MENU" = "fzf" ] &&
|
|
OPTS="$FZF_OPTS" &&
|
|
RUN=""
|
|
|
|
[ "$MODE" = "run" ] && $MENU$RUN $OPTS
|
|
[ "$MODE" = "pass" ] && < /dev/null | $MENU $OPTS
|
|
[ "$MODE" = "empty" ] && < /dev/null | $MENU $OPTS
|
|
[ -z "$MODE" ] && $MENU $OPTS
|