Created
February 9, 2023 10:47
-
-
Save themoonisacheese/b38c56dd6d343a7a8891a820db00f881 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#[email protected] | |
#nowplaying: display currently playing song based on playerctl info (dbus) | |
#dependencies: playerctl: https://github.com/altdesktop/playerctl | |
#use with watch (man watch) for live-ish updates ex: watch -tc nowplaying | |
#spawn a window specifically for a widget-style thing ex: uxterm -bg "#333" -fg "#fff" -geometry 100x1 -e watch -wtc nowplaying | |
STATUS=`playerctl status 2>&1` | |
if [[ $STATUS == 'No players found' ]]; then | |
echo "No music" | |
else | |
TITLE=`playerctl metadata title` | |
ARTIST=`playerctl metadata artist` | |
echo -ne "Current track: \033[1m$ARTIST - $TITLE\033[0m" | |
if [[ $STATUS == "Playing" ]]; then | |
echo "" | |
else | |
echo " ($STATUS)" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment