mirror of
https://github.com/DerTyp7/.dotfiles.git
synced 2025-10-29 21:17:10 +01:00
Add waybar configs
This commit is contained in:
18
waybar/modules/spotify.sh
Executable file
18
waybar/modules/spotify.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
class=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
|
||||
icon=""
|
||||
|
||||
if [[ $class == "playing" ]]; then
|
||||
info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}')
|
||||
if [[ ${#info} > 40 ]]; then
|
||||
info=$(echo $info | cut -c1-40)"..."
|
||||
fi
|
||||
text=$info" "$icon
|
||||
elif [[ $class == "paused" ]]; then
|
||||
text=$icon
|
||||
elif [[ $class == "stopped" ]]; then
|
||||
text=""
|
||||
fi
|
||||
|
||||
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
|
||||
Reference in New Issue
Block a user