Compare commits

..

5 Commits

Author SHA1 Message Date
appeasementPolitik
f59ebe88a7
Merge 1500ec504e44c3b2a3367c6bb54c1be865f7416e into b8cd0ab4953d053fef09c48ba04f2fbb2df57aa4 2023-10-03 21:24:42 +00:00
appeasementPolitik
1500ec504e
Use actual locks instead of pgrep 2023-10-03 21:23:15 +00:00
appeasementPolitik
b5317fdaf2
Merge branch 'master' into async 2023-10-03 20:40:48 +00:00
sban
b8cd0ab495
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
2023-09-05 07:51:05 +00:00
Hylke Hellinga
c550a7c6e5
Fixed Booksplit for termux (#1358)
Co-authored-by: Simbaclaws <h.hellinga@inner-join.nl>
2023-09-03 07:20:13 +00:00
6 changed files with 12 additions and 11 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

@ -12,7 +12,7 @@ inputaudio="$1"
ext="${1##*.}"
# Get a safe file name from the book.
escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
escbook="$(echo "$booktitle" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
! mkdir -p "$escbook" &&
echo "Do you have write access in this directory?" &&
@ -31,7 +31,7 @@ do
cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -metadata total=\"$total\" -ss \"$start\" -to \"$end\" -vn -c:a copy \"$file\" "
fi
title="$(echo "$x" | cut -d' ' -f2-)"
esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
esctitle="$(echo "$title" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
track="$((track+1))"
start="$end"
done < "$2"

View File

@ -49,8 +49,8 @@ case $BLOCK_BUTTON in
esac
checkforecast && showweather ||
{ [ -z "$(pgrep 'sb-forecast' | tail -n +3)" ] &&
( flock -n 9 &&
( until { [ "$(cat /sys/class/net/w*/operstate)" = 'up' ] || [ "$(cat /sys/class/net/e*/operstate)" = 'up' ]; } &&
getforecast; do sleep 60; done &&
pkill -RTMIN+"${1:-5}" "${STATUSBAR:-dwmblocks}" ) &
echo; }
echo ) 9>/tmp/sb-forecast.lock

View File

@ -9,11 +9,11 @@ ifinstalled "geoip" || exit 1
ipfile="$XDG_RUNTIME_DIR/iplocate"
addr=$(cat "$ipfile" 2>/dev/null) && addr=$(geoiplookup "$addr" 2>/dev/null) && rm "$ipfile" ||
{ [ -z "$(pgrep 'sb-iplocate' | tail -n +3)" ] &&
( flock -n 9 &&
( until { [ "$(cat /sys/class/net/w*/operstate)" = 'up' ] || [ "$(cat /sys/class/net/e*/operstate)" = 'up' ]; } &&
curl -sf ifconfig.me --output "$ipfile"; do sleep 60; done &&
curl -sf api.ipify.org --output "$ipfile"; do sleep 60; done &&
pkill -RTMIN+"${1:-27}" "${STATUSBAR:-dwmblocks}" ) &
echo; exit; }
echo; exit ) 9>/tmp/sb-iplocate.lock
name="${addr##*, }"
flag="$(grep "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji")"
flag="${flag%% *}"

View File

@ -5,11 +5,11 @@
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
{ [ -z "$(pgrep 'sb-moonphase' | tail -n +3)" ] &&
( flock -n 9 &&
( until { [ "$(cat /sys/class/net/w*/operstate)" = 'up' ] || [ "$(cat /sys/class/net/e*/operstate)" = 'up' ]; } &&
curl -sf "wttr.in/?format=%m" --output "$moonfile" && touch "$moonfile"; do sleep 60; done &&
pkill -RTMIN+"${1:-17}" "${STATUSBAR:-dwmblocks}" ) &
echo; exit; }
echo; exit ) 9>/tmp/sb-moonphase.lock
icon="$(cat "$moonfile")"

View File

@ -51,11 +51,11 @@ esac
updateprice && notify-send "$icon Update complete." "$name price is now \$$(cat "$pricefile")"
else
[ -n "$4" ] &&
{ [ -z "$(pgrep 'sb-price' | tail -n +3)" ] &&
( flock -n 9 &&
( until { [ "$(cat /sys/class/net/w*/operstate)" = 'up' ] || [ "$(cat /sys/class/net/e*/operstate)" = 'up' ]; } &&
updateprice; do sleep 60; done &&
pkill -RTMIN+"$4" "${STATUSBAR:-dwmblocks}" ) &
echo; exit; } ||
echo; exit ) 9>/tmp/sb-price.lock ||
updateprice
fi