mirror of
https://github.com/hydroxycarbamide/dotfiles.git
synced 2025-05-08 13:49:07 -04:00
Add waybar
This commit is contained in:
parent
e0c17f71e2
commit
1ff2d77058
19 changed files with 1043 additions and 0 deletions
41
dot_config/waybar/modules/mpris/executable_album_art.sh
Normal file
41
dot_config/waybar/modules/mpris/executable_album_art.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
#!/bin/bash
|
||||
|
||||
write_art() {
|
||||
album_art=$(playerctl -p $1 metadata mpris:artUrl)
|
||||
status=$?
|
||||
if [[ -z $album_art || $status -eq 0 ]]
|
||||
then
|
||||
album_art=$(playerctl metadata mpris:artUrl)
|
||||
if [[ -z $album_art ]]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
curl -s "${album_art}" --output "/tmp/cover.jpeg"
|
||||
echo "/tmp/cover.jpeg"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
|
||||
declare -a PAUSED
|
||||
for player in "${PLAYERS[@]}"; do
|
||||
[ "$player" = "playerctld" ] && continue;
|
||||
|
||||
p_status=$(playerctl -p "$player" status 2>/dev/null)
|
||||
|
||||
# if we have one playing, we'll use it and EXIT
|
||||
if [ "$p_status" = "Playing" ]; then
|
||||
write_art "$player"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
[ "$p_status" = "Paused" ] && PAUSED+=("$player")
|
||||
done
|
||||
|
||||
if [ -n "${PAUSED[0]}" ]; then
|
||||
write_art "${PAUSED[0]}"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue