fix(macos): hide spotify sketchybar item if nothing playing
This commit is contained in:
parent
1dc567c9b0
commit
5d3b030cd4
@ -13,10 +13,10 @@ bar=(
|
||||
padding_right=0
|
||||
padding_left=3
|
||||
corner_radius="$CORNER_RADIUS"
|
||||
y_offset=1
|
||||
y_offset=0
|
||||
margin=5
|
||||
blur_radius=20
|
||||
notch_width=200
|
||||
notch_width=195
|
||||
)
|
||||
|
||||
defaults=(
|
||||
|
||||
33
private_dot_config/sketchybar/items/network.sh
Normal file
33
private_dot_config/sketchybar/items/network.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$PINK"
|
||||
|
||||
props=(
|
||||
update_freq=60
|
||||
icon.color="$COLOR"
|
||||
icon.padding_left=10
|
||||
label.padding_right=10
|
||||
label.color="$COLOR"
|
||||
background.height=26
|
||||
background.corner_radius="$CORNER_RADIUS"
|
||||
background.padding_right=5
|
||||
background.border_width="$BORDER_WIDTH"
|
||||
background.border_color="$COLOR"
|
||||
background.color="$BAR_COLOR"
|
||||
background.drawing=on
|
||||
script="$PLUGIN_DIR/network.sh"
|
||||
)
|
||||
|
||||
sketchybar --add item network left \
|
||||
--set network \
|
||||
"${props[@]}"
|
||||
|
||||
|
||||
sketchybar --add item separator left \
|
||||
--set separator icon= \
|
||||
icon.font="$FONT:Regular:16.0" \
|
||||
background.padding_left=15 \
|
||||
background.padding_right=15 \
|
||||
label.drawing=off \
|
||||
associated_display=active \
|
||||
icon.color="$YELLOW"
|
||||
@ -5,8 +5,8 @@ MUSIC_EVENT="com.spotify.client.PlaybackStateChanged"
|
||||
COLOR="$GREEN"
|
||||
|
||||
props=(
|
||||
scroll_texts=on
|
||||
icon=
|
||||
scroll_texts="on"
|
||||
icon=""
|
||||
icon.color="$COLOR"
|
||||
icon.padding_left=10
|
||||
background.color="$BAR_COLOR"
|
||||
@ -26,4 +26,4 @@ sketchybar --add event music_change $MUSIC_EVENT \
|
||||
--add item music q \
|
||||
--subscribe music music_change \
|
||||
--set music ${bracket_defaults[@]} \
|
||||
"${props[@]}"
|
||||
"${props[@]}"
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
USERNAME=$(networksetup -listpreferredwirelessnetworks en0 | sed -n '2p' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
||||
|
||||
sketchybar --set "$NAME" icon="" label="$USERNAME"
|
||||
@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
update() {
|
||||
PLAYING=1
|
||||
|
||||
if [ "$(echo "$INFO" | jq -r '.["Player State"]')" = "Playing" ]; then
|
||||
PLAYING=0
|
||||
TRACK="$(echo "$INFO" | jq -r .Name | cut -c1-40)"
|
||||
@ -22,6 +21,11 @@ update() {
|
||||
else
|
||||
args+=(--set music icon=)
|
||||
fi
|
||||
|
||||
if [[ $INFO == "" ]]; then
|
||||
args+=(--set music drawing=off)
|
||||
fi
|
||||
|
||||
sketchybar -m "${args[@]}"
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user