From 0c8fa3a2a270747f3dbb54fe8792f3f0aec997e3 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Mon, 3 Aug 2026 01:22:44 -0400 Subject: 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. --- users/ryan/linux/waybar/modules/spotify.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 users/ryan/linux/waybar/modules/spotify.sh (limited to 'users/ryan/linux/waybar/modules/spotify.sh') 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 @@ +#!/bin/sh + +class=$(playerctl metadata --format '{{lc(status)}}') +icon="󰎆" + +if [[ $class == "playing" ]]; then + info=$(playerctl metadata --format '{{artist}} - {{title}}') + if [[ ${#info} > 40 ]]; then + info=$(playerctl metadata --format '{{title}}' | 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.3.1