My dotfiles. Period.

i3staplus 577B

1234567891011121314151617181920212223242526272829
  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": "red"' ;;
  13. esac
  14. printf '{"full_text": " %s"%s}' \
  15. "$layout" "$color"
  16. }
  17. i3status \
  18. | while true
  19. do
  20. read line
  21. case $line in
  22. '[{'*) line="[$(kb_layout),{${line#\[\{}" ;;
  23. ',[{'*) line=",[$(kb_layout),{${line#,\[\{}" ;;
  24. esac
  25. echo "$line"
  26. done