2020-05-15 15:06:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-05-20 18:34:34 +02:00
|
|
|
######################################################################
|
2020-05-23 15:47:21 +02:00
|
|
|
# @author : swytch (adapated from github.com/jschx/ufetch)
|
|
|
|
# @file : fetch
|
|
|
|
# @license : GPLv3
|
|
|
|
# @created : Wednesday May 20, 2020 18:16:09 CEST
|
2020-05-20 18:34:34 +02:00
|
|
|
#
|
2020-05-23 15:47:21 +02:00
|
|
|
# @description : display system infos
|
2020-05-20 18:34:34 +02:00
|
|
|
######################################################################
|
|
|
|
|
2020-05-15 15:06:43 +02:00
|
|
|
|
|
|
|
## 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
|