Add mpc information to i3bar
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a721616ea9
commit
a740804cf3
2 changed files with 25 additions and 0 deletions
|
@ -29,6 +29,9 @@ separator_block_width=15
|
|||
markup=pango
|
||||
|
||||
|
||||
[mpc]
|
||||
interval=5
|
||||
|
||||
[arch-update]
|
||||
interval=600
|
||||
|
||||
|
|
22
.config/i3blocks/mpc
Executable file
22
.config/i3blocks/mpc
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
[ $(mpc | wc -l) -eq 1 ] && {
|
||||
printf '<span color="#7f7f7f">\uf9da</span>'
|
||||
exit
|
||||
}
|
||||
|
||||
title=$(mpc | head -n1 | tr -cd "[:print:]")
|
||||
state=$(mpc | grep '^\[' | sed -E 's/^\[(.+)\].*/\1/')
|
||||
|
||||
case ${state} in
|
||||
playing)
|
||||
printf '\uf909 <span color="#8faafc">%s</span>' "${title}"
|
||||
;;
|
||||
paused)
|
||||
printf '\uf8e3 <span color="#7f7f7f">%s</span>' "${title}"
|
||||
;;
|
||||
*)
|
||||
printf '<span color="#dd0000">State: %s Title: %s<span>' ${state} "${title}"
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue