Using archey with Today Scripts - SamRothCA/Today-Scripts GitHub Wiki

Archey in Today Scripts

If you want archey to behave nicely in today scripts copy and paste the following in a file. In our example I will put it in /Users/Goat_user/Documents/archey (Goat_user is my default user).

#!/bin/bash

# System Variables
user=$(whoami)
hostname=$(hostname | sed 's/.local//g')
distro="OS X $(sw_vers -productVersion)"
kernel=$(uname)
uptime=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')
shell="$SHELL"
terminal="$TERM"
cpu=$(sysctl -n machdep.cpu.brand_string)
packagehandler=""

# removes (R) and (TM) from the CPU name so it fits in a standard 80 window

cpu=$(echo "$cpu" | awk '$1=$1' | sed 's/([A-Z]\{1,2\})//g')

mem=$(sysctl -n hw.memsize)
ram="$((mem/1073741824)) GB"
disk=`df | head -2 | tail -1 | awk '{print $5}'`

# Colors Variables
red="1"
green="2"
yellow="3"
blue="4"
purple="5"
lightblue="6"
grey="7"

textColor=$(tput setaf $lightblue)
normal=$(tput sgr0)

# Add a -c option to enable classic color logo
if [[ $1 == "-c" ]] || [[ $1 == "--color" ]] || [[ $2 == "-c" ]] || [[ $2 == "--color" ]]; then
  GREEN='\033[00;32m'
  YELLOW='\033[00;33m'
  LRED='\033[01;31m'
  RED='\033[00;31m'
  PURPLE='\033[00;35m'
  CYAN='\033[00;36m'
  BLUE='\033[00;34m'
fi

userText="${textColor}User:${normal}"
hostnameText="${textColor}Hostname:${normal}"
distroText="${textColor}Distro:${normal}"
kernelText="${textColor}Kernel:${normal}"
uptimeText="${textColor}Uptime:${normal}"
shellText="${textColor}Shell:${normal}"
terminalText="${textColor}Terminal:${normal}"
cpuText="${textColor}CPU:${normal}"
memoryText="${textColor}Memory:${normal}"
diskText="${textColor}Disk:${normal}"

echo -e "${GREEN}                 ###
${GREEN}               ####
${GREEN}               ###
${GREEN}       #######    #######
${YELLOW}     ######################
${YELLOW}    #####################
${RED}    ####################
${RED}    ####################
${RED}    #####################
${PURPLE}     ######################
${PURPLE}      ####################
${BLUE}        ################
${BLUE}         ####     ##### ${normal}

$userText $user
$hostnameText $hostname
$distroText $distro
$kernelText $kernel
$uptimeText $uptime
$shellText $shell
$terminalText $terminal
$cpuText $cpu
$memoryText $ram
$diskText $disk
"

After, make the file executable by openning a terminal by going to the spotlight and type ‘terminal’ In there, I will make a file executable by typing:

chmod +x /Users/Goat_user/Documents/archey

Now, in today scripts, all you have to do is: Give it a Title

Program should be /bin/bash

and for the last box it will be: /Users/Goat_user/Documents/archey -c

⚠️ **GitHub.com Fallback** ⚠️