aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/menuman
blob: 868d8011755f9847fa7a294cfa53c7f838beffd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Search and open man page

list="$(man -k . | awk '{ print $1$2 }')"

if [ "$1" = "-t" ]; then
  chosen=$(printf "$list" | fzf)
else
  # Source settings from .bemenurc
  . ~/.config/bemenurc

  action="$TERMINAL -e"
  chosen=$(printf "$list" | bemenu -p "Select man page:" -i -l 25 --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")
fi

if [ -z "$chosen" ]; then
    exit 0
fi

[ -n "$action" ] && $action "man $chosen" && exit 0
man $chosen