Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #156 from dylanaraps/stdout_fix
Browse files Browse the repository at this point in the history
Fix stdout mode when used with the cpu function.
  • Loading branch information
dylanaraps committed Mar 17, 2016
2 parents 608a47d + a48d997 commit 098a962
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,9 @@ getcpu () {
"bar") prin "${subtitle} 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}" ;;
"off") ;;
esac
unset cpu
[ "$stdout_mode" != "on" ] && unset cpu
}

# }}}
Expand Down Expand Up @@ -1246,7 +1247,7 @@ getsong () {
esac

# Display Artist and Title on seperate lines.
if [ "$song_shorthand" == "on" ]; then
if [ "$song_shorthand" == "on" ] && [ "$stdout_mode" != "on" ]; then
artist="${song/ -*}"
song=${song/$artist - }

Expand Down Expand Up @@ -1555,7 +1556,7 @@ getbattery () {
title="$subtitle"

# 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=${battery// /%, }
battery="${battery}%"
Expand Down Expand Up @@ -2725,11 +2726,12 @@ while [ "$1" ]; do

# Stdout
--stdout)
unset info_color colors
unset -f bar
unset info_color colors cpu_display bar prin
stdout_mode="on"
config="off"
case "$2" in
"--"* | "") printf "%s\n" "--stdout requires at least one argument"; exit ;;
*) shift; args=("$@"); config="off"; stdout ;;
*) shift; args=("$@"); stdout ;;
esac
;;

Expand Down

0 comments on commit 098a962

Please sign in to comment.