-
-
Save brycepg/b5696664bb6b0c93a7cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Shell script to prepend i3status with more stuff | |
prepend_formatting="\"full_text\":\"" | |
# ----- | |
# Enter desired extra test here | |
extra_text="test" | |
# ----- | |
can_edit=false | |
prefix="" | |
suffix="\"},{" | |
i3status | while : | |
do | |
read line | |
if [[ "${line:0:2}" == "[{" ]]; then | |
prefix="[{" | |
can_edit=true | |
suffix="\"},{" | |
elif [[ "${line:0:2}" == ",[" ]]; then | |
prefix=",[{" | |
can_edit=true | |
suffix="\"}," | |
fi | |
if $can_edit ; then | |
line=$(echo $line | cut -b 1-2 --complement) | |
echo "$prefix$prepend_formatting$extra_text$suffix$line" || exit 1 | |
else | |
echo "$line" || exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment