From bf6a91943d2c5852025ed1d1aadb30d83edf0354 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Wed, 17 May 2023 00:21:45 -0400 Subject: Added personal channel, starting to add more dotfiles --- home-config/waybar/modules/spotify.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 home-config/waybar/modules/spotify.sh (limited to 'home-config/waybar/modules/spotify.sh') diff --git a/home-config/waybar/modules/spotify.sh b/home-config/waybar/modules/spotify.sh new file mode 100755 index 0000000..a75136c --- /dev/null +++ b/home-config/waybar/modules/spotify.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}') +icon="" + +if [[ $class == "playing" ]]; then + info=$(playerctl metadata --player=spotifyd --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"\"}" + -- cgit v1.2.3