diff options
author | Ryan Schanzenbacher <ryan@rschanz.org> | 2023-05-17 00:21:45 -0400 |
---|---|---|
committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2023-05-17 00:21:45 -0400 |
commit | bf6a91943d2c5852025ed1d1aadb30d83edf0354 (patch) | |
tree | a7c4efde6a1e2d18919016e9dff81aee8db8f0fe /home-config/waybar/modules/spotify.sh | |
parent | 4fe3a734d104fa1836255b18f8d8bcf4aeaa407f (diff) |
Added personal channel, starting to add more dotfiles
Diffstat (limited to 'home-config/waybar/modules/spotify.sh')
-rwxr-xr-x | home-config/waybar/modules/spotify.sh | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}') | ||
4 | icon="" | ||
5 | |||
6 | if [[ $class == "playing" ]]; then | ||
7 | info=$(playerctl metadata --player=spotifyd --format '{{artist}} - {{title}}') | ||
8 | if [[ ${#info} > 40 ]]; then | ||
9 | info=$(echo $info | cut -c1-40)"..." | ||
10 | fi | ||
11 | text=$info" "$icon | ||
12 | elif [[ $class == "paused" ]]; then | ||
13 | text=$icon | ||
14 | elif [[ $class == "stopped" ]]; then | ||
15 | text="" | ||
16 | fi | ||
17 | |||
18 | echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" | ||
19 | |||