This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/statusbar/sb-music
David JULIEN 10321a0d21 feat: use dwmblocks as statusbar
remove .local/bin/dwmbar
add .local/bin/statusbar scripts directory
update .profile ($PATH)
update .xprofile (dwmblocks at startup)
2021-02-16 00:29:24 +01:00

19 lines
634 B
Bash
Executable File

#!/usr/bin/env sh
######################################################################
# @author : swytch (swytch@$HOSTNAME)
# @file : sb-music
# @license : MIT
# @created : Saturday Feb 13, 2021 18:05:21 CET
#
# @description : music block for dwmblocks
######################################################################
mpc="$(mpc --format "%albumartist% - %title%")"
format() { tac | sed "s/^volume: n\/a.*/ 🎵 ---/g;/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/ ⏸/g;s/\\[playing\\].*/ 🎵/g" | paste -sd ' ' -;}
pgrep -f sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
echo "$mpc" | format