3 ##################################
4 ## status monitor for instantWM ##
5 ##################################
7 # will be rewritten soon
18 echo "$2" >/tmp/instantos/status/"$1"
21 mkdir -p /tmp/instantos/status
23 # update different parts with different frequency
27 if ping -q -c 1 -W 1 8.8.8.8; then
28 INTERNET="^c$GREEN^ i ^d^"
30 INTERNET="^c$RED^ i ^d^"
33 istat INTERNET "$INTERNET"
35 # battery indicator on laptop
36 if [ -n "$ISLAPTOP" ]; then
38 if [[ $TMPBAT =~ "Charging" ]]; then
39 BATTERY="^c$GREEN^ B"$(egrep -o '[0-9]*%' <<<"$TMPBAT")" "
41 BATTERY=" B"$(egrep -o '[0-9]*%' <<<"$TMPBAT")" "
42 # make indicator red on low battery
43 if [ $(grep '[0-9]*' <<<"$BATTERY") -lt 10 ]; then
44 BATTERY="^c$RED^ B$BATTERY ^d^"
47 istat BATTERY "$BATTERY"
51 # needed only for shorttime cache, remove in case it changes
52 [ -e /tmp/instantos/pasink ] && rm /tmp/instantos/pasink
58 # check for pacman updates
59 if [ "$INTERNET" = "i" ]; then
60 if UPDATES=$(checkupdates); then
61 echo "$UPDATES updates found"
62 UPDATES=$(wc -l <<<"$UPDATES")
64 echo "system is up to date"
67 istat UPDATES "U$UPDATES"
70 if ! iconf -i notheming; then
71 DATEHOUR="$(date +%H)"
72 if [ "$DATEHOUR" -lt "7" ] || [ "$DATEHOUR" -gt "20" ]; then
73 if ! [ -e /tmp/instantdarkmode ]; then
75 touch /tmp/instantdarkmode
76 [ -e /tmp/instantlightmode ] && rm /tmp/instantlightmode
79 if ! [ -e /tmp/instantlightmode ]; then
81 touch /tmp/instantlightmode
82 [ -e /tmp/instantdarkmode ] && rm /tmp/instantdarkmode
95 for i in /tmp/instantos/status/*; do
96 date="${date}$(cat $i)"
100 date="$date^d^ $(date +'%d-%m') ^c$DARKBACK^ $(date +'%H:%M') "
102 date="$date^c$LIGHTBACK^ A$(
103 (amixer -D pulse get Master || amixer sget Master) 2>/dev/null |
104 grep -Eo -m1 '1?[0-9]{1,2}%'
107 # option to disable status text
108 if [ -e ~/.instantsilent ] && [ -z "$FORCESTATUS" ]; then
109 echo "^d^^f11^$date^d^"
112 xsetroot -name "^d^^f11^$date^d^"