add shell scripts

This commit is contained in:
gutmet 2021-03-14 15:41:00 +01:00
parent 8c08817097
commit b79166e3c7
4 changed files with 51 additions and 0 deletions

21
autostart.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
clearpids() {
echo -n "" > autostart.pids
}
start() {
eval "$1 &"
pid="$!"
if ps -p "$pid" > /dev/null; then
echo "$pid" >> autostart.pids
fi
}
clearpids
start "nm-applet"
start "redshift-gtk"
start "./dumpweather.sh"
start "./dwmstatus.sh"
feh --bg-scale background.jpg

5
cleanup_autostart.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
while read pid; do
kill "$pid"
done <autostart.pids

6
dumpweather.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
while true; do
curl "wttr.in/Paderborn?m&format=j1" > weatherdump 2>/dev/null
sleep 600
done

19
dwmstatus.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
while true; do
time=`date +"🕑 %d.%m. %H:%M"`
weatherdata=`cat weatherdump`
current=`echo "$weatherdata" | jq -r '.current_condition | .[0]'`
temp=`echo "$current" | jq -r '.temp_C'`
weatherDesc=`echo "$current" | jq -r '.weatherDesc | .[0].value'`
wind=`echo "$current" | jq -r '.windspeedKmph'`
astronomy=`echo "$weatherdata" | jq -r '.weather | .[0] .astronomy | .[0]'`
moonphase=`echo "$astronomy" | jq -r '.moon_phase'`
sunrise=`echo "$astronomy" | jq -r '.sunrise'`
sunset=`echo "$astronomy" | jq -r '.sunset'`
weather="🌡 $temp°C $weatherDesc $wind""km/h Daylight $sunrise-$sunset, Moon $moonphase"
xsetroot -name "$weather $time "
sleep 10
done