aboutsummaryrefslogtreecommitdiff
path: root/bin/my-dmenu-run
blob: e6ddd2fdb6ba69873ac7c1153c8c31ada22a0d6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

tui_apps=(
    vim
    mutt

    nnn
    ranger

    newsboat
    podboat
    cmus
    ncmpcpp
)

shell=${SHELL:-"/bin/sh"}
terminal=${TERMINAL:-"/usr/bin/xterm"}

prog=$(dmenu_path | dmenu "$@")

if [[ " ${tui_apps[*]} " =~ " ${prog} " ]]; then
    prog="$terminal -e $prog"
fi

if [[ "${prog}" == emacs ]]; then
    prog="LC_CTYPE='zh_CN.UTF-8' emacs"
fi

echo "$prog" | $shell &