123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/bin/dash
-
- # prepend i3status with more stuff
-
- kb_layout() {
- local layout
- local color
- layout=$(
- setxkbmap -query \
- | awk '/layout/{print $2}'
- )
- case $layout in
- us) color='' ;;
- *) color=',"color": "#ff0000"' ;;
- esac
- printf '{"full_text": " %s"%s},' \
- "$layout" "$color"
- }
-
- bmo_be_ovw() {
- local ovw_path=.local/share/bmo/be/important.state
- local ovw
- local color
- test -s "$ovw_path" || return 0
- ovw=$(cat "$ovw_path")
- case $ovw in
- *%onbreak) color=',"color": "#33aa55"' ;;
- *%mtg) color=',"color": "#ff0000"' ;;
- *%working) color=',"color": "#cccccc"' ;;
- *) color='' ;;
- esac
- printf '{"full_text": " %s"%s},' \
- "$ovw" "$color"
- }
-
- i3status \
- | while true
- do
- read line
- case $line in
- '[{'*) line="[$(kb_layout)$(bmo_be_ovw){${line#\[\{}" ;;
- ',[{'*) line=",[$(kb_layout)$(bmo_be_ovw){${line#,\[\{}" ;;
- esac
- echo "$line"
- done
|