diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-29 16:19:18 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-29 16:19:18 +0900 |
| commit | 2f443bae9cbf11c8e2e3183c50c4b7cd21096605 (patch) | |
| tree | 0f33aa273b134339966b6db99b4d1c63116d9673 | |
| parent | 4007d650b739de47e6010daa90a5c74ece1e27aa (diff) | |
modified sketchybar/sketchybarrc, created plugins/youtube-music.sh
| -rwxr-xr-x | mac/.config/sketchybar/plugins/youtube-music.sh | 16 | ||||
| -rwxr-xr-x | mac/.config/sketchybar/sketchybarrc | 72 |
2 files changed, 69 insertions, 19 deletions
diff --git a/mac/.config/sketchybar/plugins/youtube-music.sh b/mac/.config/sketchybar/plugins/youtube-music.sh new file mode 100755 index 0000000..6767275 --- /dev/null +++ b/mac/.config/sketchybar/plugins/youtube-music.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +SONG_INFO=$(curl -s 0.0.0.0:26538/api/v1/song-info) + +PAUSED="$(echo "$SONG_INFO" | jq -r '.isPaused')" +CURRENT_SONG="$(echo "$SONG_INFO" | jq -r '.title + " - " + .artist')" +ARTWORK="$(echo "$SONG_INFO" | jq -r '.imageSrc')" +ARTWORK_LOCATION="$(curl -O --output-dir "$TMPDIR" -s --remote-name -w "%{filename_effective}" "$ARTWORK")" + +if [ "$PAUSED" = true ]; then + ICON= +else + ICON= +fi +sketchybar --set "$NAME" label="$CURRENT_SONG" icon="$ICON" drawing=on +sketchybar --set "$NAME"-artwork background.image="$ARTWORK_LOCATION" diff --git a/mac/.config/sketchybar/sketchybarrc b/mac/.config/sketchybar/sketchybarrc index b6d8b7d..dac7306 100755 --- a/mac/.config/sketchybar/sketchybarrc +++ b/mac/.config/sketchybar/sketchybarrc @@ -7,6 +7,7 @@ source "$CONFIG_DIR/colors.sh" source "$CONFIG_DIR/icons.sh" PLUGIN_DIR="$CONFIG_DIR/plugins" +ITEM_DIR="$CONFIG_DIR/items" ##### Bar Appearance ##### sketchybar --bar position=top height=42 \ @@ -148,6 +149,58 @@ sketchybar --add item calendar right \ padding_left=4 \ padding_right=4 +# Clock +sketchybar --add item clock right \ + --set clock icon="" \ + icon.font="SF Pro:Semibold:15.0" \ + icon.color=$YELLOW \ + icon.padding_left=8 \ + icon.padding_right=6 \ + label.font="SF Pro:Medium:12.0" \ + label.color=$WHITE \ + label.padding_left=4 \ + label.padding_right=8 \ + update_freq=10 \ + script="$PLUGIN_DIR/clock.sh" \ + background.color=$BACKGROUND_1 \ + background.drawing=on \ + padding_left=4 \ + padding_right=4 \ + click_script="$PLUGIN_DIR/clock_click.sh" + +source "$ITEM_DIR/music.sh" + +sketchybar --add item music center \ + --set music icon= \ + icon.padding_left=8 \ + icon.padding_right=8 \ + label.padding_right=8 \ + label.font="Hack Nerd Font:Bold:17.0" \ + label="Loading…" \ + label.align=left \ + label.max_chars=40 \ + update_freq=10 \ + script="$PLUGIN_DIR/youtube-music.sh" \ + background.image.scale=0.9 \ + background.image.corner_radius=8 \ + background.image.border_color="$TRANSPARENT" \ + background.color="$TRANSPARENT" \ + scroll_texts=on \ + padding_right=0 \ + click_script="curl -s -X POST 0.0.0.0:26538/api/v1/toggle-play && $PLUGIN_DIR/youtube-music.sh" + +sketchybar --add item music_artwork center \ + label.padding_right=8 \ + label="" \ + width=40 \ + background.image.scale=0.07 \ + background.image.corner_radius=8 \ + background.image.border_color="$TRANSPARENT" \ + background.color="$TRANSPARENT" \ + display=1 \ + padding_right=16 \ + click_script="curl -s -X POST 0.0.0.0:26538/api/v1/toggle-play && $PLUGIN_DIR/youtube-music.sh" + # Now Playing sketchybar --add item now_playing right \ --set now_playing icon.font="SF Pro:Semibold:15.0" \ @@ -204,25 +257,6 @@ sketchybar --add item input_source right \ padding_left=4 \ padding_right=4 -# Clock -sketchybar --add item clock right \ - --set clock icon="" \ - icon.font="SF Pro:Semibold:15.0" \ - icon.color=$YELLOW \ - icon.padding_left=8 \ - icon.padding_right=6 \ - label.font="SF Pro:Medium:12.0" \ - label.color=$WHITE \ - label.padding_left=4 \ - label.padding_right=8 \ - update_freq=10 \ - script="$PLUGIN_DIR/clock.sh" \ - background.color=$BACKGROUND_1 \ - background.drawing=on \ - padding_left=4 \ - padding_right=4 \ - click_script="$PLUGIN_DIR/clock_click.sh" - # Volume sketchybar --add item volume right \ --set volume icon.font="SF Pro:Semibold:15.0" \ |
