mirror of
https://github.com/eRgo35/dots.git
synced 2025-12-18 08:26:11 +01:00
dwm update in progress
This commit is contained in:
48
dwm/.dwm.old/bar/bar-functions/dwm_mpc.sh
Executable file
48
dwm/.dwm.old/bar/bar-functions/dwm_mpc.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A dwm_bar function that shows the current artist, track, position, duration, and status from mpc
|
||||
# Joe Standring <git@joestandring.com>
|
||||
# GNU GPLv3
|
||||
|
||||
# Dependencies: mpc
|
||||
|
||||
dwm_mpc () {
|
||||
if ps -C mpd > /dev/null; then
|
||||
ARTIST=$(mpc current -f %artist%)
|
||||
TRACK=$(mpc current -f %title%)
|
||||
POSITION=$(mpc status | grep "%)" | awk '{ print $3 }' | awk -F/ '{ print $1 }')
|
||||
DURATION=$(mpc current -f %time%)
|
||||
STATUS=$(mpc status | sed -n 2p | awk '{print $1;}')
|
||||
SHUFFLE=$(mpc status | tail -n 1 | awk '{print $6}')
|
||||
|
||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
||||
if [ "$STATUS" = "[playing]" ]; then
|
||||
STATUS="▶"
|
||||
else
|
||||
STATUS="⏸"
|
||||
fi
|
||||
|
||||
if [ "$SHUFFLE" = "on" ]; then
|
||||
SHUFFLE=" 🔀"
|
||||
else
|
||||
SHUFFLE=""
|
||||
fi
|
||||
else
|
||||
if [ "$STATUS" = "[playing]" ]; then
|
||||
STATUS="PLA"
|
||||
else
|
||||
STATUS="PAU"
|
||||
fi
|
||||
|
||||
if [ "$SHUFFLE" = "on" ]; then
|
||||
SHUFFLE=" S"
|
||||
else
|
||||
SHUFFLE=""
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "%s%s %s - %s %s/%s%s%s" "$SEP1" "$STATUS" "$ARTIST" "$TRACK" "$POSITION" "$DURATION" "$SHUFFLE" "$SEP2"
|
||||
fi
|
||||
}
|
||||
|
||||
dwm_mpc
|
||||
Reference in New Issue
Block a user