mirror of
https://git.in.rschanz.org/ryan77627/guix-config.git
synced 2024-11-07 07:36:09 -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,
|
||||
"return-type": "json",
|
||||
"exec": "~/.config/waybar/modules/spotify.sh",
|
||||
"exec-if": "pgrep spotifyd",
|
||||
"exec-if": "~/.config/waybar/modules/check-for-music.sh",
|
||||
"escape": true,
|
||||
"on-click": "~/.config/waybar/modules/spotify-play-pause.sh play-pause"
|
||||
"on-click": "playerctl play-pause"
|
||||
},
|
||||
"custom/storage": {
|
||||
"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
|
||||
|
||||
class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}')
|
||||
icon=""
|
||||
class=$(playerctl metadata --format '{{lc(status)}}')
|
||||
icon=""
|
||||
|
||||
if [[ $class == "playing" ]]; then
|
||||
info=$(playerctl metadata --player=spotifyd --format '{{artist}} - {{title}}')
|
||||
info=$(playerctl metadata --format '{{artist}} - {{title}}')
|
||||
if [[ ${#info} > 40 ]]; then
|
||||
info=$(echo $info | cut -c1-40)"..."
|
||||
info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..."
|
||||
fi
|
||||
text=$info" "$icon
|
||||
elif [[ $class == "paused" ]]; then
|
||||
|
|
Loading…
Reference in a new issue