Commit 098a962b authored by Dylan Araps's avatar Dylan Araps

Merge pull request #156 from dylanaraps/stdout_fix

Fix stdout mode when used with the cpu function.
parents 608a47dd a48d997b
...@@ -959,8 +959,9 @@ getcpu () { ...@@ -959,8 +959,9 @@ getcpu () {
"bar") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" $(( 100 * ${cores} )))" ;; "bar") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" $(( 100 * ${cores} )))" ;;
"infobar") prin "${subtitle} Usage: ${cpu_usage} $(bar "${cpu_usage/'%'}" $(( 100 * ${cores} )))" ;; "infobar") prin "${subtitle} Usage: ${cpu_usage} $(bar "${cpu_usage/'%'}" $(( 100 * ${cores} )))" ;;
"barinfo") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" $(( 100 * ${cores} ))) ${cpu_usage}" ;; "barinfo") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" $(( 100 * ${cores} ))) ${cpu_usage}" ;;
"off") ;;
esac esac
unset cpu [ "$stdout_mode" != "on" ] && unset cpu
} }
# }}} # }}}
...@@ -1246,7 +1247,7 @@ getsong () { ...@@ -1246,7 +1247,7 @@ getsong () {
esac esac
# Display Artist and Title on seperate lines. # Display Artist and Title on seperate lines.
if [ "$song_shorthand" == "on" ]; then if [ "$song_shorthand" == "on" ] && [ "$stdout_mode" != "on" ]; then
artist="${song/ -*}" artist="${song/ -*}"
song=${song/$artist - } song=${song/$artist - }
...@@ -1555,7 +1556,7 @@ getbattery () { ...@@ -1555,7 +1556,7 @@ getbattery () {
title="$subtitle" title="$subtitle"
# If shorthand is on, print each value on the same line # If shorthand is on, print each value on the same line
if [ "$battery_shorthand" == "on" ]; then if [ "$battery_shorthand" == "on" ] || [ "$stdout_mode" == "on" ]; then
battery=${batteries[*]} battery=${batteries[*]}
battery=${battery// /%, } battery=${battery// /%, }
battery="${battery}%" battery="${battery}%"
...@@ -2725,11 +2726,12 @@ while [ "$1" ]; do ...@@ -2725,11 +2726,12 @@ while [ "$1" ]; do
# Stdout # Stdout
--stdout) --stdout)
unset info_color colors unset info_color colors cpu_display bar prin
unset -f bar stdout_mode="on"
config="off"
case "$2" in case "$2" in
"--"* | "") printf "%s\n" "--stdout requires at least one argument"; exit ;; "--"* | "") printf "%s\n" "--stdout requires at least one argument"; exit ;;
*) shift; args=("$@"); config="off"; stdout ;; *) shift; args=("$@"); stdout ;;
esac esac
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment