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"
68 if ! iconf -i notheming; then
69 DATEHOUR="$(date +%H)"
70 if [ "$DATEHOUR" -lt "7" ] || [ "$DATEHOUR" -gt "20" ]; then
71 if ! [ -e /tmp/instantdarkmode ]; then
73 touch /tmp/instantdarkmode
74 [ -e /tmp/instantlightmode ] && rm /tmp/instantlightmode
77 if ! [ -e /tmp/instantlightmode ]; then
79 touch /tmp/instantlightmode
80 [ -e /tmp/instantdarkmode ] && rm /tmp/instantdarkmode
93 for i in /tmp/instantos/status/*; do
94 date="${date}$(cat $i)"
98 date="$date^d^ $(date +'%d-%m') ^c$DARKBACK^ $(date +'%H:%M') "
100 date="$date^c$LIGHTBACK^ A$(amixer get Master | grep -Eo '[0-9]{1,3}%' | head -1) "
102 # option to disable status text
103 if [ -e ~/.instantsilent ] && [ -z "$FORCESTATUS" ]; then
104 echo "^d^^f11^$date^d^"
107 xsetroot -name "^d^^f11^$date^d^"