Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
#fixing battery issue in #17 by changing how the fields are displayed…
Browse files Browse the repository at this point in the history
…, if battery is empty it doesn't effect layout
  • Loading branch information
Jeff Hann committed Oct 30, 2015
1 parent e08be71 commit c710b81
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions bin/archey
Original file line number Diff line number Diff line change
Expand Up @@ -96,42 +96,45 @@ case "${packager}" in
;;
esac

userText="${textColor}User:${normal} ${user}${normal}"
hostnameText="${textColor}Hostname:${normal} ${hostname}${normal}"
distroText="${textColor}Distro:${normal} ${distro}${normal}"
kernelText="${textColor}Kernel:${normal} ${kernel}${normal}"
uptimeText="${textColor}Uptime:${normal} ${uptime}${normal}"
fieldlist=()

fieldlist[${#fieldlist[@]}]="${textColor}User:${normal} ${user}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Hostname:${normal} ${hostname}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Distro:${normal} ${distro}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Kernel:${normal} ${kernel}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Uptime:${normal} ${uptime}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Shell:${normal} ${shell}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Terminal:${normal} ${terminal}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Packages:${normal} ${packagehandler}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}CPU:${normal} ${cpu}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Memory:${normal} ${ram}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Disk:${normal} ${disk}${normal}"
if [ ! -z $battery ]; then
fieldlist[${#fieldlist[@]}]="${textColor}Battery:${normal} ${battery}${normal}"
fi
if [ "${opt_offline}" = f ]; then
ipText="${textColor}IP Address:${normal} ${ip}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}IP Address:${normal} ${ip}${normal}"
fi
shellText="${textColor}Shell:${normal} ${shell}${normal}"
terminalText="${textColor}Terminal:${normal} ${terminal}${normal}"
packagehandlerText="${textColor}Packages:${normal} ${packagehandler}${normal}"
cpuText="${textColor}CPU:${normal} ${cpu}${normal}"
memoryText="${textColor}Memory:${normal} ${ram}${normal}"
diskText="${textColor}Disk:${normal} ${disk}${normal}"
batteryText="${textColor}Battery:${normal} ${battery}${normal}"

if [ -a "${HOME}/.config/archey-logo" ]
then
source "${HOME}/.config/archey-logo"
else
# The ${foo# } is a cheat so that it lines up here as well
# as when run.
echo -e "
${GREEN# } ### $userText
${GREEN# } #### $hostnameText
${GREEN# } ### $distroText
${GREEN# } ####### ####### $kernelText
${YELLOW# } ###################### $uptimeText
${YELLOW# } ##################### $shellText
${RED# } #################### $terminalText
${RED# } #################### $packagehandlerText
${RED# } ##################### $cpuText
${PURPLE# } ###################### $memoryText
${PURPLE# } #################### $diskText
${BLUE# } ################ $batteryText
${BLUE# } #### ##### $ipText
${normal}
"
echo -e "
${GREEN# } ### ${fieldlist[0]}
${GREEN# } #### ${fieldlist[1]}
${GREEN# } ### ${fieldlist[2]}
${GREEN# } ####### ####### ${fieldlist[3]}
${YELLOW# } ###################### ${fieldlist[4]}
${YELLOW# } ##################### ${fieldlist[5]}
${RED# } #################### ${fieldlist[6]}
${RED# } #################### ${fieldlist[7]}
${RED# } ##################### ${fieldlist[8]}
${PURPLE# } ###################### ${fieldlist[9]}
${PURPLE# } #################### ${fieldlist[10]}
${BLUE# } ################ ${fieldlist[11]}
${BLUE# } #### ##### ${fieldlist[12]}
${normal} "
fi

0 comments on commit c710b81

Please sign in to comment.