12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #!/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
- "") color='' ;;
- *) color=',"color": "#ff0000"' ;;
- 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
|