aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/madd
blob: d1cb8ef84277af4e89f689369f0553d82a2c3d47 (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 | rofi -dmenu -l 30 -case-smart)
fi

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