Fix weird behaviour with prin and --stdout

This commit is contained in:
Dylan 2016-02-06 01:22:29 +11:00
parent a69b86a22a
commit 4ad5cf791d
1 changed files with 6 additions and 5 deletions

11
fetch
View File

@ -1235,7 +1235,7 @@ getbattery () {
# If there's only a single battery and it's battery 0, # If there's only a single battery and it's battery 0,
# don't number the subtitle. # don't number the subtitle.
if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then
prin "${title}: ${batteries[0]}%" battery="$(prin "${title}: ${batteries[0]}%")"
return return
fi fi
@ -1858,10 +1858,11 @@ prin () {
esac esac
# Print the info # Print the info
printf "%b%s" "${padding}${string}${clear}" if [ "$stdout" == "on" ]; then
printf "%s" "${string}${stdout_seperator}"
# If stdout mode is off, print a newline too. else
[ "$stdout" == "off" ] && printf "\n" printf "%b%s\n" "${padding}${string}${clear}"
fi
} }
# }}} # }}}