aboutsummaryrefslogtreecommitdiff
path: root/src/title.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/title.sh')
-rwxr-xr-xsrc/title.sh22
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"