My dotfiles. Period.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/dash
  2. # prepend i3status with more stuff
  3. kb_layout() {
  4. local layout
  5. local color
  6. layout=$(
  7. setxkbmap -query \
  8. | awk '/layout/{print $2}'
  9. )
  10. case $layout in
  11. us) color='' ;;
  12. *) color=',"color": "#ff0000"' ;;
  13. esac
  14. printf '{"full_text": " %s"%s},' \
  15. "$layout" "$color"
  16. }
  17. bmo_be_ovw() {
  18. local ovw_path=.local/share/bmo/be/important.state
  19. local ovw
  20. local color
  21. test -s "$ovw_path" || return 0
  22. ovw=$(cat "$ovw_path")
  23. case $ovw in
  24. "") color='' ;;
  25. *) color=',"color": "#ff0000"' ;;
  26. esac
  27. printf '{"full_text": " %s"%s},' \
  28. "$ovw" "$color"
  29. }
  30. i3status \
  31. | while true
  32. do
  33. read line
  34. case $line in
  35. '[{'*) line="[$(kb_layout)$(bmo_be_ovw){${line#\[\{}" ;;
  36. ',[{'*) line=",[$(kb_layout)$(bmo_be_ovw){${line#,\[\{}" ;;
  37. esac
  38. echo "$line"
  39. done