diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-29 21:16:59 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-29 21:16:59 +0900 |
| commit | 15c7512e4f40abf0a130c6d5013dde1c87336715 (patch) | |
| tree | 1178be6388ff045818efec6e9ff74e3ba0610ff6 | |
| parent | 166301f7cfdf7f9cc9e5b9596a97b62980f66157 (diff) | |
modified plugins/weather.sh, modified sketchybar/sketchybarrc
| -rwxr-xr-x | mac/.config/sketchybar/plugins/weather.sh | 62 | ||||
| -rwxr-xr-x | mac/.config/sketchybar/sketchybarrc | 122 |
2 files changed, 93 insertions, 91 deletions
diff --git a/mac/.config/sketchybar/plugins/weather.sh b/mac/.config/sketchybar/plugins/weather.sh index b96bab8..f408508 100755 --- a/mac/.config/sketchybar/plugins/weather.sh +++ b/mac/.config/sketchybar/plugins/weather.sh @@ -5,48 +5,48 @@ source "$CONFIG_DIR/colors.sh" # Cache file for weather data CACHE_FILE="/tmp/sketchybar_weather_cache" -CACHE_DURATION=1800 # 30 minutes +CACHE_DURATION=1800 # 30 minutes # Function to get weather data get_weather() { - # You can replace this with your preferred weather API - # For now, using a simple placeholder - local location="San Francisco" # Change to your location - - # Try to get weather from wttr.in (simple text-based weather) - local weather_data=$(curl -s "wttr.in/$location?format=3" 2>/dev/null) - - if [ -n "$weather_data" ]; then - echo "$weather_data" - else - echo "Weather unavailable" - fi + # You can replace this with your preferred weather API + # For now, using a simple placeholder + local location="San Francisco" # Change to your location + + # Try to get weather from wttr.in (simple text-based weather) + local weather_data=$(curl -s "wttr.in/$location?format=3" 2>/dev/null) + + if [ -n "$weather_data" ]; then + echo "$weather_data" + else + echo "Weather unavailable" + fi } # Check if cache is valid if [ -f "$CACHE_FILE" ]; then - cache_time=$(stat -f %m "$CACHE_FILE" 2>/dev/null || echo 0) - current_time=$(date +%s) - - if [ $((current_time - cache_time)) -lt $CACHE_DURATION ]; then - weather=$(cat "$CACHE_FILE") - else - weather=$(get_weather) - echo "$weather" > "$CACHE_FILE" - fi -else + cache_time=$(stat -f %m "$CACHE_FILE" 2>/dev/null || echo 0) + current_time=$(date +%s) + + if [ $((current_time - cache_time)) -lt $CACHE_DURATION ]; then + weather=$(cat "$CACHE_FILE") + else weather=$(get_weather) - echo "$weather" > "$CACHE_FILE" + echo "$weather" >"$CACHE_FILE" + fi +else + weather=$(get_weather) + echo "$weather" >"$CACHE_FILE" fi # Extract temperature and condition if [[ "$weather" =~ ([0-9.-]+°[CF]) ]]; then - temp="${BASH_REMATCH[1]}" - sketchybar --set "$NAME" label="$temp" \ - icon.color=$BLUE \ - label.color=$WHITE + temp="${BASH_REMATCH[1]}" + sketchybar --set "$NAME" label="$temp" \ + icon.color=$BLUE \ + label.color=$WHITE else - sketchybar --set "$NAME" label="N/A" \ - icon.color=$GREY \ - label.color=$GREY + sketchybar --set "$NAME" label="N/A" \ + icon.color=$GREY \ + label.color=$GREY fi diff --git a/mac/.config/sketchybar/sketchybarrc b/mac/.config/sketchybar/sketchybarrc index 8f67334..eaec5d1 100755 --- a/mac/.config/sketchybar/sketchybarrc +++ b/mac/.config/sketchybar/sketchybarrc @@ -130,50 +130,13 @@ sketchybar --add item front_app left \ script="$PLUGIN_DIR/front_app.sh" \ --subscribe front_app front_app_switched -##### Right Side Items ##### - -# Calendar Events -sketchybar --add item calendar right \ - --set calendar icon.font="SF Pro:Semibold:12.0" \ - icon.padding_left=8 \ - icon.padding_right=6 \ - label.font="SF Pro:Medium:10.0" \ - label.padding_left=4 \ - label.padding_right=8 \ - label.max_chars=25 \ - update_freq=86400 \ - script="$PLUGIN_DIR/calendar.sh" \ - background.color=$BACKGROUND_1 \ - background.drawing=on \ - background.height=26 \ - 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" - -sketchybar --add item music center \ +# YouTube Music +sketchybar --add item music left \ --set music icon= \ icon.padding_left=8 \ icon.padding_right=8 \ label.padding_right=8 \ - label.font="Hack Nerd Font:Bold:17.0" \ + label.font="Hack Nerd Font:Bold:12.0" \ label="Loading…" \ label.align=left \ label.max_chars=40 \ @@ -187,7 +150,8 @@ sketchybar --add item music center \ 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 \ +# YouTube Music Info +sketchybar --add item music_artwork left \ label.padding_right=8 \ label="" \ width=40 \ @@ -200,21 +164,59 @@ sketchybar --add item music_artwork center \ 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" \ +# sketchybar --add item now_playing right \ +# --set now_playing icon.font="SF Pro:Semibold:12.0" \ +# icon.padding_left=8 \ +# icon.padding_right=6 \ +# label.font="SF Pro:Medium:12.0" \ +# label.padding_left=4 \ +# label.padding_right=8 \ +# update_freq=2 \ +# script="$PLUGIN_DIR/now_playing.sh" \ +# background.color=$BACKGROUND_1 \ +# background.drawing=on \ +# drawing=off \ +# padding_left=4 \ +# padding_right=4 + +##### Right Side Items ##### + +# Calendar Events +sketchybar --add item calendar right \ + --set calendar icon.font="SF Pro:Semibold:12.0" \ icon.padding_left=8 \ icon.padding_right=6 \ - label.font="SF Pro:Medium:12.0" \ + label.font="SF Pro:Medium:10.0" \ label.padding_left=4 \ label.padding_right=8 \ - update_freq=2 \ - script="$PLUGIN_DIR/now_playing.sh" \ + label.max_chars=25 \ + update_freq=86400 \ + script="$PLUGIN_DIR/calendar.sh" \ background.color=$BACKGROUND_1 \ background.drawing=on \ - drawing=off \ + background.height=26 \ 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" + # WiFi Status sketchybar --add item wifi right \ --set wifi icon.font="SF Pro:Semibold:15.0" \ @@ -309,19 +311,19 @@ sketchybar --add item pritunl right \ # Weather # sketchybar --add item weather right \ -# --set weather icon="" \ -# icon.font="SF Pro:Semibold:15.0" \ -# icon.color=$BLUE \ -# icon.padding_left=8 \ -# icon.padding_right=6 \ -# label.padding_left=4 \ -# label.padding_right=8 \ -# update_freq=1800 \ -# script="$PLUGIN_DIR/weather.sh" \ -# background.color=$BACKGROUND_1 \ -# background.drawing=on \ -# padding_left=4 \ -# padding_right=4 +# --set weather icon="" \ +# icon.font="SF Pro:Semibold:15.0" \ +# icon.color=$BLUE \ +# icon.padding_left=8 \ +# icon.padding_right=6 \ +# label.padding_left=4 \ +# label.padding_right=8 \ +# update_freq=1800 \ +# script="$PLUGIN_DIR/weather.sh" \ +# background.color=$BACKGROUND_1 \ +# background.drawing=on \ +# padding_left=4 \ +# padding_right=4 ##### Finalize Setup ##### sketchybar --update |
