aboutsummaryrefslogtreecommitdiff
path: root/src/title.sh
blob: e83d91ce47690695dde73e402f828a93dd06dc1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
status="$(playerctl status)"

output=""

echo "$status" | grep Playing > /dev/null && output="♫▶ "
echo "$status" | grep Paused > /dev/null && output="♫⏸️ "
echo "$status" | grep Stopped > /dev/null && output="♫⏹️ "

# set to 1 to enable song title and artist name
en=0
if [ $en = 1 ]; then
    title="$(playerctl metadata title)"
    artist="$(playerctl metadata artist)"
    if [ "$artist" ]; then
		output=$(printf -- "%s%s | %s" "$output" "$title" "$artist")
    else
		output=$(printf -- "%s%s" "$output" "$title")
    fi
fi

printf -- "%s" "$output"