#!/bin/bash

w="$(tput setaf 4)"
c="${w}$(tput bold)"
r="$(tput sgr0)$(tput setaf 6)"

f=$(tput sgr0)
for n in {0..7}; do
  printf -v f${n} "%b" $(tput setaf ${n})
done

# install date
if [[ -e /var/log/pacman.log ]]; then
    in="$(ls -ctl --time-style +"%H:%M:%S %d.%m.%Y" /etc | awk 'END{print $7}')"
fi

wm=$(wmctrl -m 2>/dev/null |
  grep "Name" |
  cut -d " " -f2)

[[ -z $wm ]] && wm="$(xprop -root -notype _NET_WM_NAME | awk 'END{print $3}' | tr -d \")" || wm=$wm

os=$(
  source /etc/os-release
  echo "$NAME"
)

pk=$(pacman -Qq | wc -l)

tr="$([[ -n $DISPLAY && $(command -v urxvt) ]] && echo urxvt || echo ${TERM/-256color/})"

mm=$(free -m | grep Mem | awk '{print $3}' )
mm+=" Mb"

clear

cat <<- LOL
${f4}  ____     ${w}os${c}:${r} $os
${f5} /\   \\    ${w}in${c}:${r} $in
${f6}/  \___\\   ${w}wm${c}:${r} $wm
${f4}\  /   /   ${w}pk${c}:${r} $pk
${f5} \/___/    ${w}tr${c}:${r} $tr
${f5}           ${w}mm${c}:${r} $mm

${f1}██${f2}██${f3}██${f4}██${f5}██${f6}██${f7}██${f}
LOL
