aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/madd
blob: 130fd853a6eebccc20ccf215ade01eeb8cdddb13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

madd() {
    queue="$(mpc playlist)"
    if [ -z "$queue" ]; then
        mpc insert "$filename"
        mpc play
    else
        mpc insert "$filename"
        mpc next
    fi
}

if [ -t 0 ]; then
    filename=$(mpc listall | fzf)
else
    filename=$(mpc listall | fuzzel -d -l 30)
fi

if [ -n "$filename" ]; then
    madd
fi