aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/sketchybar/bar-config/plugins/spotify.sh
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2026-07-11 22:14:43 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2026-07-11 22:14:43 -0400
commitd2b62c9d6f30a0ea88b2a235cde120cd10ba332b (patch)
treef373003e64c3ec4593d7ae4ffac72de52767aa70 /users/ryan/modules/sketchybar/bar-config/plugins/spotify.sh
parent27117202739f092d837af2752e4b9801c47b8ddb (diff)
Sketchybar now, got tired of the battery issue
Diffstat (limited to 'users/ryan/modules/sketchybar/bar-config/plugins/spotify.sh')
-rwxr-xr-xusers/ryan/modules/sketchybar/bar-config/plugins/spotify.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/users/ryan/modules/sketchybar/bar-config/plugins/spotify.sh b/users/ryan/modules/sketchybar/bar-config/plugins/spotify.sh
new file mode 100755
index 0000000..8d91297
--- /dev/null
+++ b/users/ryan/modules/sketchybar/bar-config/plugins/spotify.sh
@@ -0,0 +1,20 @@
1#!/usr/bin/env bash
2# custom/spotify -> now playing, driven by the native media_change event.
3source "$HOME/.config/sketchybar/icons.sh"
4
5# Waybar on-click: playerctl play-pause
6if [ "$1" = "toggle" ]; then
7 osascript -e 'tell application "Spotify" to playpause' 2>/dev/null
8 exit 0
9fi
10
11STATE="$(printf '%s' "$INFO" | sed -nE 's/.*"state":"([^"]*)".*/\1/p')"
12TITLE="$(printf '%s' "$INFO" | sed -nE 's/.*"title":"([^"]*)".*/\1/p')"
13ARTIST="$(printf '%s' "$INFO" | sed -nE 's/.*"artist":"([^"]*)".*/\1/p')"
14
15# exec-if check-for-music -> only draw while something is playing
16if [ "$STATE" = "playing" ] && [ -n "$TITLE" ]; then
17 sketchybar --set "$NAME" drawing=on label="$TITLE - $ARTIST"
18else
19 sketchybar --set "$NAME" drawing=off
20fi