From 9719bf85b55eaa7795ca6cc69ac86902af39eb35 Mon Sep 17 00:00:00 2001 From: jschx Date: Sun, 11 Jun 2017 22:54:43 -0500 Subject: [PATCH] Fix several issues with ufetch-macos --- ufetch-macos | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/ufetch-macos b/ufetch-macos index f5bbb00..ab6ae1f 100755 --- a/ufetch-macos +++ b/ufetch-macos @@ -6,14 +6,26 @@ ## INFO # user is already defined -host="${HOSTNAME%%.*}" -software="$(system_profiler SPSoftwareDataType)" -os=$(echo "$software" | grep 'System Version' -m 1) -kernel="$(echo "$software" | grep 'Kernel' -m 1)" +host="$(hostname)" +os="$(sw_vers -productName) $(sw_vers -productVersion)" +kernel="$(uname -sr)" uptime="$(uptime | awk -F, '{sub(".*up ",x,$1);print $1}' | sed -e 's/^[ \t]*//')" -packages=( `brew list` `brew cask list` ) +if command -v pkgin &> /dev/null; then + packages="$(pkgin list | wc -l)" +elif command -v brew &> /dev/null; then + brew_packages="$(brew list | wc -l)" + cask_packages="$(brew cask list 2> /dev/null | wc -l)" + packages="$(( ${brew_packages} + ${cask_packages} ))" +elif command -v port &> /dev/null; then + packages="$(port installed | wc -l)" +else + packages='no package manager' +fi +packages="$(echo ${packages} | sed -e 's/^[ /t]*//')" shell="$(basename ${SHELL})" -WM="Quartz Compositor" +if [ -z "${WM}" ]; then + WM='Quartz Compositor' +fi ## DEFINE COLORS @@ -31,23 +43,25 @@ rc="$(tput sgr0)" # reset # you can change these lc="${rc}${bc}${c4}" # labels -nc="${rc}${bc}${c6}" # user and hostname +nc="${rc}${bc}${c4}" # user and hostname ic="${rc}${bc}${c7}" # info -fc="${rc}${c6}" # first color -sc="${rc}${c7}" # second color -tc="${rc}${bc}${c3}" # third color +pc="${rc}${c2}" # primary color +sc="${rc}${c3}" # secondary color +tc="${rc}${c1}" # tertiary color +qc="${rc}${c5}" # quaternary color +uc="${rc}${c6}" # quinary color ## OUTPUT cat <