1234567891011121314151617181920212223242526272829 |
- #!/bin/dash
-
- # prepend i3status with more stuff
-
- mkfield() {
- local layout
- local color
- layout=$(
- setxkbmap -query \
- | awk '/layout/{print $2}'
- )
- case $layout in
- us) color='' ;;
- *) color=',"color": "red"' ;;
- esac
- printf '{"full_text": " %s"%s}' \
- "$layout" "$color"
- }
-
- i3status \
- | while true
- do
- read line
- case $line in
- '[{'*) line="[$(mkfield),{${line#\[\{}" ;;
- ',[{'*) line=",[$(mkfield),{${line#,\[\{}" ;;
- esac
- echo "$line"
- done
|