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.
2021-02-13 20:17:23 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
######################################################################
|
2021-02-15 00:12:27 +01:00
|
|
|
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
|
2021-02-13 20:17:23 +01:00
|
|
|
# @file : sb-music
|
2021-02-15 00:37:34 +01:00
|
|
|
# @license : GPLv3
|
2021-02-13 20:17:23 +01:00
|
|
|
# @created : Saturday Feb 13, 2021 18:05:21 CET
|
|
|
|
#
|
|
|
|
# @description : music block for dwmblocks
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
|
|
|
|
mpc="$(mpc --format "%albumartist% - %title%")"
|
2021-02-16 20:53:50 +01:00
|
|
|
format() { tac | sed "s/^volume:n\/a.*//g;/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;s/\\[playing\\].*/🎵/g" | paste -sd ' ' -;}
|
2021-02-13 20:17:23 +01:00
|
|
|
|
|
|
|
pgrep -f sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
|
|
|
|
|
2021-02-16 20:53:50 +01:00
|
|
|
mpc=$(echo "$mpc" | format)
|
|
|
|
[ -n "$mpc" ] && printf " %s " "$mpc"
|