3 ##################################
4 ## status monitor for instantWM ##
5 ##################################
16 echo "$2" >/tmp/instantos/status/"$1"
19 mkdir -p /tmp/instantos/status
21 # update different parts with different frequency
25 if ping -q -c 1 -W 1 8.8.8.8; then
26 INTERNET="^c$GREEN^ i ^d^"
28 INTERNET="^c$RED^ i ^d^"
31 istat INTERNET "$INTERNET"
33 # battery indicator on laptop
34 if [ -n "$ISLAPTOP" ]; then
36 if [[ $TMPBAT =~ "Charging" ]]; then
37 BATTERY="^c$GREEN^ B"$(egrep -o '[0-9]*%' <<<"$TMPBAT")" "
39 BATTERY=" B"$(egrep -o '[0-9]*%' <<<"$TMPBAT")" "
40 # make indicator red on low battery
41 if [ $(grep '[0-9]*' <<<"$BATTERY") -lt 10 ]; then
42 BATTERY="^c$RED^ B$BATTERY ^d^"
45 istat BATTERY "$BATTERY"
49 # needed only for shorttime cache, remove in case it changes
50 [ -e /tmp/instantos/pasink ] && rm /tmp/instantos/pasink
56 # check for pacman updates
57 if [ "$INTERNET" = "i" ]; then
58 if UPDATES=$(checkupdates); then
59 echo "$UPDATES updates found"
60 UPDATES=$(wc -l <<<"$UPDATES")
62 echo "system is up to date"
65 istat UPDATES "U$UPDATES"
73 # option to disable status text and check for enabling it again
74 if [ -e ~/.instantsilent ] && [ -z "$FORCESTATUS" ]; then
79 for i in /tmp/instantos/status/*; do
80 date="${date}$(cat $i)"
84 date="$date^d^ $(date +'%d-%m') ^c$DARKBACK^ $(date +'%H:%M') "
86 date="$date^c$LIGHTBACK^ A$(amixer get Master | grep -Eo '[0-9]{1,3}%' | head -1) "
89 xsetroot -name "^d^^f11^$date^d^"