aboutsummaryrefslogtreecommitdiffstats
path: root/moc/.local/bin/mocpnotify-stop
blob: 4626e224d393dd76ca92147166858654f6508757 (plain) (blame)
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
30
31
#!/bin/sh -ex

_mocp_args="-M $HOME/.config/moc"
_mocp_tmp="/tmp/mocp"
[ -d "$_mocp_tmp" ] || mkdir -p "$_mocp_tmp"

_mocp_write() {
    mocp $_mocp_args -Q "%$1" > "$_mocp_tmp/$1.txt"
}

_mocp_clear() {
    echo "no song playing" > "$_mocp_tmp/song.txt"
    echo "" > "$_mocp_tmp/artist.txt"
    echo "" > "$_mocp_tmp/album.txt"
}

case $(basename $0 | cut -d- -f2) in
    "next")
        notify-send -a mocp -t 3000 "now playing" "$1 - $2 [$3]"
        _mocp_write artist
        _mocp_write album
        _mocp_write song
        ;;
    "stop")
        notify-send -a mocp -t 3000 "mocp" "stopped playing"
        _mocp_clear
        ;;
    *)
        #passthrough
        ;;
esac