diff --git a/autostart.sh b/autostart.sh new file mode 100755 index 0000000..448cf2a --- /dev/null +++ b/autostart.sh @@ -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 diff --git a/cleanup_autostart.sh b/cleanup_autostart.sh new file mode 100755 index 0000000..851b812 --- /dev/null +++ b/cleanup_autostart.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +while read pid; do + kill "$pid" +done weatherdump 2>/dev/null + sleep 600 +done diff --git a/dwmstatus.sh b/dwmstatus.sh new file mode 100755 index 0000000..dcb74ec --- /dev/null +++ b/dwmstatus.sh @@ -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