This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/fetch

51 lines
1.5 KiB
Plaintext
Raw Normal View History

#!/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