1
0
Fork 0

make status bar scripts posix compliant

This commit is contained in:
Luca Bilke 2022-08-10 17:01:49 +02:00
parent f6a261e89e
commit 6d825b3148
4 changed files with 10 additions and 10 deletions

View file

@ -7,8 +7,8 @@
# You could set up a shell alias to view the full file in a pager in the
# terminal if desired. This function will only be run once a day when needed.
# Options can be found at https://wttr.in/:help
weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport"
weatheremoji="${XDG_DATA_HOME:-$HOME/.local/share}/weatheremoji"
weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
weatheremoji="${XDG_CACHE_HOME:-$HOME/.cache}/weatheremoji"
url="wttr.in/Karlsruhe"
opt="?F"
emojiopt="?format=1"
@ -25,15 +25,15 @@ s/🌧//
s/🌨//
s/🌩//
s/🌫//
' ${weatheremoji}
' "${weatheremoji}"
}
getforecast() { curl -sf "$url$opt" > "$weatherreport" && curl -sf "$url$emojiopt" > "$weatheremoji" || exit 1 ;}
# Some very particular and terse stream manipulation. We get the maximum
# precipitation chance and the daily high and low from the downloaded file and
# display them with coresponding emojis.
showweather() { emoji=$(cat $weatheremoji) && printf "%s" "$(sed '16q;d' "$weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/ ${emoji:0:1} /g;1q" | tr -d '\n')"
showweather() { emoji=$(cat "$weatheremoji") && printf "%s" "$(sed '16q;d' "$weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/ $(printf %.1s "$emoji") /g;1q" | tr -d '\n')"
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "  " $1 "°"," " $2 "°"}' ;}
case $BLOCK_BUTTON in

View file

@ -4,7 +4,7 @@
# When clicked, brings up `neomutt`.
case $BLOCK_BUTTON in
1) setsid -f claws-mail --alternate-config-dir $CLAWSRC ;;
1) setsid -f claws-mail --alternate-config-dir "$CLAWSRC" ;;
2) setsid -f mw -Y >/dev/null ;;
3) notify-send " Mail module" "\- Shows unread mail
- Shows 痢 if syncing mail

View file

@ -1,12 +1,12 @@
#!/bin/sh
filter() {
if mpc &>/dev/null && [[ $(mpc | wc -l) -eq 3 ]]; then
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
song=$(mpc current -f "%artist% - %title%" | xargs -0 )
[[ $(echo $song | wc -m) -gt 35 ]] && song="${song:0:34}…"
[ ${#song} -gt 35 ] && song="$(printf %.35s song)…"
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
echo " $icon $song "
elif mpc &>/dev/null && [[ $(mpc | wc -l) -eq 1 ]]; then
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
echo " ﱙ "
else
exit 1

View file

@ -7,7 +7,7 @@ case $BLOCK_BUTTON in
2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;;
3) notify-send "📢 Volume module" "\- Shows volume 墳, ﱝ if muted.
3) notify-send "蓼Volume module" "\- Shows volume , ﱝ if muted.
- Middle click to mute.
- Scroll to change." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;