mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
add scripts
This commit is contained in:
25
projects/scripts/waybar/playerctl.sh
Executable file
25
projects/scripts/waybar/playerctl.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
PLAYER="$1"
|
||||
|
||||
if [ -z "$PLAYER" ]; then
|
||||
echo "Usage: $0 <player>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATUS="$(playerctl -p "$PLAYER" status)"
|
||||
|
||||
if [ -z "$STATUS" ] || [ "$STATUS" = "Stopped" ]; then
|
||||
exit 0
|
||||
elif [ "$STATUS" = "Paused" ]; then
|
||||
STATUS=" "
|
||||
elif [ "$STATUS" = "Playing" ]; then
|
||||
STATUS=" "
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TITLE="$(playerctl -p "$PLAYER" metadata title)"
|
||||
ARTIST="$(playerctl -p "$PLAYER" metadata artist)"
|
||||
|
||||
printf "%s\n" "$STATUS$TITLE - $ARTIST"
|
||||
Reference in New Issue
Block a user