Timeout added to forecast module, ncmpcpp now tracks player state (#1359)

* Added timeout to getforecast to prevent status bar breakage.

A 2 second timeout is used in the case that wttr.in is inaccessible when dwm is started; as otherwise it tries to curl wttr.in indefinitely, not allowing other status bar modules to be loaded.

* Update music status bar module on player state change
This commit is contained in:
sban 2023-09-05 07:51:05 +00:00 committed by GitHub
parent c550a7c6e5
commit b8cd0ab495
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -31,3 +31,4 @@ progressbar_elapsed_color = blue:b
statusbar_color = red
statusbar_time_color = cyan:b
execute_on_song_change="pkill -RTMIN+11 dwmblocks"
execute_on_player_state_change="pkill -RTMIN+11 dwmblocks"

View file

@ -7,7 +7,7 @@ url="${WTTRURL:-wttr.in}"
weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
# Get a weather report from 'wttr.in' and save it locally.
getforecast() { curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; }
getforecast() { timeout --signal=1 2s curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; }
# Forecast should be updated only once a day.
checkforecast() {