3 # ufetch-macos - tiny system info for macos
7 # user is already defined
9 os
="$(sw_vers -productName) $(sw_vers -productVersion)"
11 uptime
="$(uptime | awk -F, '{sub(".
*up
",x,$1);print $1}' | sed -e 's/^[ \t]*//')"
12 shell
="$(basename "${SHELL}")"
14 ## PACKAGE MANAGER DETECTION
16 if [ -x "$(command -v nix-info)" ]; then
17 packages
="$(ls -d -1 /nix/store/*/ | wc -l)"
18 elif [ -x "$(command -v pkgin)" ]; then
19 packages
="$(pkgin list | wc -l)"
20 elif [ -x "$(command -v brew)" ]; then
21 brew_packages
="$(brew list --formulae | wc -l)"
22 cask_packages
="$(brew list --cask 2> /dev/null | wc -l)"
23 packages
="$(( ${brew_packages} + ${cask_packages} ))"
24 elif [ -x "$(command -v port)" ]; then
25 packages
="$(port installed | wc -l)"
30 packages
="$(echo "${packages}" | sed -e 's/^[ /t]*//')"
34 if [ -n "${DE}" ]; then
37 elif [ -n "${WM}" ]; then
45 ui
="$(basename "${ui}")"
49 # probably don't change these
50 if [ -x "$(command -v tput)" ]; then
51 bold
="$(tput bold 2> /dev/null)"
52 black
="$(tput setaf 0 2> /dev/null)"
53 red
="$(tput setaf 1 2> /dev/null)"
54 green
="$(tput setaf 2 2> /dev/null)"
55 yellow
="$(tput setaf 3 2> /dev/null)"
56 blue
="$(tput setaf 4 2> /dev/null)"
57 magenta
="$(tput setaf 5 2> /dev/null)"
58 cyan
="$(tput setaf 6 2> /dev/null)"
59 white
="$(tput setaf 7 2> /dev/null)"
60 reset="$(tput sgr0 2> /dev/null)"
63 # you can change these
64 lc
="${reset}${bold}" # labels
65 nc
="${reset}${bold}" # user and hostname
67 c0
="${reset}" # first color
73 ${c0} (/ ${nc}${USER}${ic}@${nc}${host}${reset}
74 ${c0} .---__--. ${lc}OS: ${ic}${os}${reset}
75 ${c0} / \ ${lc}KERNEL: ${ic}${kernel}${reset}
76 ${c0} | / ${lc}UPTIME: ${ic}${uptime}${reset}
77 ${c0} | \\_ ${lc}PACKAGES: ${ic}${packages}${reset}
78 ${c0} \ / ${lc}SHELL: ${ic}${shell}${reset}
79 ${c0} \`._.-._.\` ${lc}${uitype}: ${ic}${ui}${reset}