feat: add fetch script

fetch system infos
lighter than neofetch
remove neofetch
This commit is contained in:
swy7ch 2020-05-15 15:06:43 +02:00
parent 0dad71d5b7
commit b0d1cc61dc
2 changed files with 50 additions and 0 deletions

50
.local/bin/fetch Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
# based on ufetch - https://gitlab.com/jschx/ufetch/
## INFO
# $USER is already defined
host="$(cat /etc/hostname)"
os='Arch Linux'
kernel="$(uname -sr)"
uptime="$(uptime -p | sed 's/up //')"
packages="$(pacman -Q | wc -l)"
shell="$(basename "$SHELL")"
wm="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
memav="$(grep "MemAvailable" /proc/meminfo | cut -d ':' -f 2 | awk '{ print int($1 / 1024) }')"
memtot="$(grep "MemTotal" /proc/meminfo | cut -d ':' -f 2 | awk '{ print int($1 / 1024) }')"
memus="$(expr $memtot - $memav)"
# set colors
if [ -x "$(command -v tput)" ]; then
bold="$(tput bold)"
black="$(tput setaf 0)"
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"
fi
# you can change these
lc="${bold}${blue}" # labels
nc="${bold}${magenta}" # user and hostname
ic="${reset}" # info
c0="${reset}" # first color
cat <<EOF
${c0} ${nc}${USER}${ic}@${nc}${host}
${c0} /\\ ${lc}OS: ${ic}${os}
${c0} / \\ ${lc}KERNEL: ${ic}${kernel}
${c0} /\\ \\ ${lc}SHELL: ${ic}${shell}
${c0} / \\ ${lc}WM: ${ic}${wm}
${c0} / ,, \\ ${lc}UPTIME: ${ic}${uptime}
${c0} / | | -\\ ${lc}PACKAGES: ${ic}${packages}
${c0} /_-'' ''-_\\ ${lc}MEMORY: ${ic}${memus}kB/${memtot}kB
EOF