diff options
| author | Ryan Schanzenbacher <ryan@rschanz.org> | 2026-08-03 01:22:44 -0400 |
|---|---|---|
| committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2026-08-03 01:22:44 -0400 |
| commit | 0c8fa3a2a270747f3dbb54fe8792f3f0aec997e3 (patch) | |
| tree | 6f94ff3aeea2af859c7c166e01a8e73002017893 /users/ryan/linux/waybar/modules/spotify.sh | |
Initial commit: combined darwin + guix-linux home-manager flake
Supersedes nix-dotfiles (darwin) and guix-dotfiles' ad-hoc
nix-home-manager flake (linux). See README.md/MIGRATION.md.
Diffstat (limited to 'users/ryan/linux/waybar/modules/spotify.sh')
| -rwxr-xr-x | users/ryan/linux/waybar/modules/spotify.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/users/ryan/linux/waybar/modules/spotify.sh b/users/ryan/linux/waybar/modules/spotify.sh new file mode 100755 index 0000000..fc732a1 --- /dev/null +++ b/users/ryan/linux/waybar/modules/spotify.sh | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | class=$(playerctl metadata --format '{{lc(status)}}') | ||
| 4 | icon="" | ||
| 5 | |||
| 6 | if [[ $class == "playing" ]]; then | ||
| 7 | info=$(playerctl metadata --format '{{artist}} - {{title}}') | ||
| 8 | if [[ ${#info} > 40 ]]; then | ||
| 9 | info=$(playerctl metadata --format '{{title}}' | 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 | |||
