1234567891011121314151617181920212223242526272829 |
- #!/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": "red"' ;;
- esac
- printf '{"full_text": " %s"%s}' \
- "$layout" "$color"
- }
-
- i3status \
- | while true
- do
- read line
- case $line in
- '[{'*) line="[$(kb_layout),{${line#\[\{}" ;;
- ',[{'*) line=",[$(kb_layout),{${line#,\[\{}" ;;
- esac
- echo "$line"
- done
|