diff options
| author | iceyrazor <iceyrazor@mailfence.com> | 2026-07-03 22:02:56 -0500 |
|---|---|---|
| committer | iceyrazor <iceyrazor@mailfence.com> | 2026-07-03 22:02:56 -0500 |
| commit | 0ed6c602b14554a02f7782bd5e5635b1e9d9c195 (patch) | |
| tree | 54142376e4cedd1aeec259f811c04a2420a3213f /src/title.sh | |
init
Diffstat (limited to 'src/title.sh')
| -rwxr-xr-x | src/title.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/title.sh b/src/title.sh new file mode 100755 index 0000000..e83d91c --- /dev/null +++ b/src/title.sh @@ -0,0 +1,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" |
