Skip to content

Instantly share code, notes, and snippets.

@RowanFeely
Created April 18, 2020 10:40
Show Gist options
  • Save RowanFeely/9c26b2c7fbce2b676d7046587623a04e to your computer and use it in GitHub Desktop.
Save RowanFeely/9c26b2c7fbce2b676d7046587623a04e to your computer and use it in GitHub Desktop.
#!/bin/sh
# ██
# ░██
# ███████████████ ██ ████ ██
# ░░░██░░██░░██░░█░██ ░█░░██ ██
# ░██ ░██ ░██ ░█░██ ░██░░███
# ░██ ░██ ░██ ░█░██ ░██ ██░██
# ░░█████ ░██ ░█░░████████ ░░██
# ░░░░░ ░░ ░░ ░░░░░░░░ ░░
# ██ ██ ██ ██ ██
# ░██ ░██ ░░ █████░██ ░██
# █████████████████ ███████ ██ ██████ ██████████░░░█░██ ██████
# ██░░░░░░██░░░░░░░█░░░██░██ ░████░░░░████░░██░░░█░██ ░█░█████░░░██░
# ░░█████ ░██ ███████ ░██░██ ░█░░████░░░░░ ░██ ░░█░░█████░██░░░██░██
# ░░░░░██░██ ██░░░░██ ░██░██ ░██░░░░░██ ░██ ░██░░░░░█░██ ░██░██
# ██████ ░░█░░████████░░█░░████████████ ░███ ░██ █████░██ ░██░░██
# ░░░░░░ ░░ ░░░░░░░░ ░░ ░░░░░░░░░░░░ ░░░ ░░ ░░░░░ ░░ ░░ ░░
#
# ▓▓▓▓▓▓▓▓▓▓
# ░▓ author ▓ ROGUE[X3] <rowanfeely.github.io>
# ░▓ code ▓ https://github.com/RowanFeely/dotfiles
# ░▓ ▓ http://rowanfeely.github.io
# ░▓▓▓▓▓▓▓▓▓▓
# ░░░░░░░░░░
#
FULL=▓
EMPTY=░
EOL=▒
SIZE=7
C0="#2e3440"
C1="#2e3440"
C2="#5E81AC"
C3="#C16069"
C4="#3B4253"
C5="#D8DEE9"
C6="#434c5e"
C7="#4c566a"
draw()
{
perc=$1
SIZE=$2
inc=$(( perc * SIZE / 100 ))
out=
thiscolor=
for v in `seq 0 $(( SIZE - 1 ))`; do
test "$v" -le "$inc" \
&& out="${out}#[fg=$C4]${FULL}" \
|| out="${out}#[fg=$C4]${EMPTY}"
done
echo $out
}
temp() # DONE
{
t=$(istats cpu temp --no-labels | awk -F . '{print $1}' | tr -d 'C°')
tc=$C0
case 1 in
$((t <= 50)))
tc=$C2
;;
$((t >= 75)))
tc=$C3
;;
esac
echo "#[fg=$tc]$t"°c
}
bat() # DONE
{
STATUS=$(mac battery | grep "Internal" | awk '{print $4}' | tr -d ';')
bp=$(mac battery | grep "Internal" | awk '{print $3}' | tr -d '%;')
stat=$STATUS
case $stat in
full)
st="="
;;
discharging)
st="-"
;;
charging)
st="+"
;;
esac
test "$bp" -lt 15 \
&& bc=red \
|| bc=#2e3440
echo "#[fg=$C4]$st""#[fg=$bc]$bp"%
}
cpu() # DONE
{
~/.tmux/plugins/tmux-cpu/scripts/cpu_percentage.sh | awk -F '.' '{print $1}'
}
ram() # DONE
{
memory_pressure | grep "System-wide" | awk '{print $5}' | tr -d "%"
}
vpn() # DONE
{
#pgrep openconnect >/dev/null 2>&1 && echo "#[fg=3]VPN"
echo "#[fg=#3B4253]#[fg=#2e3440]VPN#[fg=$C5]"
}
clock() # DONE
{
mtime=$(date +'%I:%M')
ampm=$(date +'%p')
myear=$(date +'%Y')
mmonth=$(date +'%m')
mday=$(date +'%d')
echo " #[bg=$C4]#[fg=brightwhite] $mtime#[fg=white] $mday#[fg=#78808f]-$mmonth#[fg=#4c566a]-$myear #[fg=$C6]"$EOL
}
wifi(){
signal=$(airport -I | grep agrCtlRSSI | awk '{print $2}' | sed 's/-//g')
sc=#2e3440
case 1 in
$((signal >= 50)))
sc=#3B4253
;;
$((signal <= 40)))
sc=$C2
;;
esac
echo "#[fg=$sc]"$signal"db"
}
front()
{
echo "#[bg=#4c566a]#[fg=#2e3440]█▓▒░"
}
CPU_INFO=`cpu`
RAM_INFO=`ram`
echo `front` `bat` `draw $RAM_INFO 4` `temp` `draw $CPU_INFO 6` `wifi` `clock`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment