mirror of
https://git.in.rschanz.org/ryan77627/guix-config.git
synced 2025-01-30 18:31:18 -05:00
added music info to waybar
This commit is contained in:
parent
e8351e69e9
commit
f9f087f055
3 changed files with 13 additions and 6 deletions
|
@ -75,9 +75,9 @@
|
||||||
"interval": 2,
|
"interval": 2,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"exec": "~/.config/waybar/modules/spotify.sh",
|
"exec": "~/.config/waybar/modules/spotify.sh",
|
||||||
"exec-if": "pgrep spotifyd",
|
"exec-if": "~/.config/waybar/modules/check-for-music.sh",
|
||||||
"escape": true,
|
"escape": true,
|
||||||
"on-click": "~/.config/waybar/modules/spotify-play-pause.sh play-pause"
|
"on-click": "playerctl play-pause"
|
||||||
},
|
},
|
||||||
"custom/storage": {
|
"custom/storage": {
|
||||||
"format-alt": "{} ",
|
"format-alt": "{} ",
|
||||||
|
|
7
home-config/waybar/modules/check-for-music.sh
Executable file
7
home-config/waybar/modules/check-for-music.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [[ $(playerctl metadata --format '{{lc(status)}}' | grep playing) -eq 0 ]]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}')
|
class=$(playerctl metadata --format '{{lc(status)}}')
|
||||||
icon=""
|
icon=""
|
||||||
|
|
||||||
if [[ $class == "playing" ]]; then
|
if [[ $class == "playing" ]]; then
|
||||||
info=$(playerctl metadata --player=spotifyd --format '{{artist}} - {{title}}')
|
info=$(playerctl metadata --format '{{artist}} - {{title}}')
|
||||||
if [[ ${#info} > 40 ]]; then
|
if [[ ${#info} > 40 ]]; then
|
||||||
info=$(echo $info | cut -c1-40)"..."
|
info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..."
|
||||||
fi
|
fi
|
||||||
text=$info" "$icon
|
text=$info" "$icon
|
||||||
elif [[ $class == "paused" ]]; then
|
elif [[ $class == "paused" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue