#!/usr/bin/env bash # z0mbi3 # https://github.com/gh0stzk/dotfiles # z0mbi3.zk@protonmail.com # This script is a modified version of https://github.com/Mangeshrex/rxfetch esc="" rst="${esc}[0m" c1=""; c2=""; c3=""; c4="" c5=""; c6=""; c7=""; c8="" c9=""; c10=""; c11=""; c12="" c13=""; c14=""; c15=""; c16="" c17=""; c18=""; c19=""; c20="" c21=""; c22=""; c23=""; c24="" c25=""; c26=""; c27=""; c28="" c29=""; c30=""; c31=""; c32="" c33=""; c34=""; c35=""; c36="" c37=""; c38=""; c39=""; c40="" c41=""; c42=""; c43=""; c44="" c45=""; c46=""; c47=""; c48="" c49=""; c50=""; c51=""; c52="" c53=""; c54=""; c55=""; c56="" c57=""; c58=""; c59=""; c60="" c61=""; c62=""; c63=""; c64="" c65=""; c66=""; c67=""; c68="" c69=""; c70=""; c71=""; c72="" c73=""; c74=""; c75=""; c76="" c77=""; c78=""; c79=""; c80="" c81=""; c82=""; c83=""; c84="" c85=""; c86=""; c87=""; c88="" c89=""; c90=""; c91=""; c92="" c93=""; c94=""; c95=""; c96="" c97=""; c98=""; c99=""; c100="" c101=""; c102=""; c103=""; c104="" c105=""; c106=""; c107=""; c108="" c109=""; c110=""; c111=""; c112="" c113=""; c114=""; c115=""; c116="" c117=""; c118=""; c119=""; c120="" c121=""; c122=""; c123=""; c124="" c125=""; c126=""; c127=""; c128="" c129=""; c130=""; c131=""; c132="" c133=""; c134=""; c135=""; c136="" c137=""; c138=""; c139=""; c140="" c141=""; c142=""; c143=""; c144="" c145=""; c146=""; c147=""; c148="" c149=""; c150=""; c151=""; c152="" c153=""; c154=""; c155=""; c156="" c157=""; c158=""; c159=""; c160="" c161=""; c162=""; c163=""; c164="" c165=""; c166=""; c167=""; c168="" c169=""; c170=""; c171=""; c172="" c173=""; c174=""; c175=""; c176="" c177=""; c178=""; c179=""; c180="" c181=""; c182=""; c183=""; c184="" c185=""; c186=""; c187=""; c188="" c189=""; c190=""; c191=""; c192="" c193=""; c194=""; c195=""; c196="" c197=""; c198=""; c199=""; c200="" c201=""; c202=""; c203=""; c204="" c205=""; c206=""; c207=""; c208="" c209=""; c210=""; c211=""; c212="" c213=""; c214=""; c215=""; c216="" c217=""; c218=""; c219=""; c220="" c221=""; c222="" #colors CBK=$(tput setaf 0) CRE=$(tput setaf 1) CGR=$(tput setaf 2) CYE=$(tput setaf 3) CBL=$(tput setaf 4) CMA=$(tput setaf 5) CCY=$(tput setaf 6) CWH=$(tput setaf 7) CBD=$(tput bold) CNC=$(tput sgr0) get_init() { if pidof -q systemd; then echo 'systemd' elif [ -f '/sbin/openrc' ]; then echo 'openrc' elif [ -f '/sbin/dinit' ]; then echo 'dinit' else cut -d ' ' -f 1 /proc/1/comm fi } get_uptime() { uptime -p | sed 's/up//' } get_pkg_count() { package_managers=('xbps-install' 'apk' 'port' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge' 'eopkg') for package_manager in "${package_managers[@]}"; do if command -v "$package_manager" 2>/dev/null >&2; then case "$package_manager" in xbps-install) xbps-query -l | wc -l ;; apk) apk search | wc -l ;; apt) if [ "$kernel" != "Darwin" ]; then echo $(($(apt list --installed 2>/dev/null | wc -l) - 1)) else echo 0 fi ;; pacman) pacman -Q | wc -l ;; nix) nix-env -qa --installed '*' | wc -l ;; dnf) dnf list installed | wc -l ;; rpm) rpm -qa | wc -l ;; emerge) qlist -I | wc -l ;; port) port installed 2>/dev/null | wc -l | awk 'NR==1{print $1}' ;; eopkg) eopkg li | wc -l ;; esac # if a package manager is found return from the function return fi done echo 0 } # Get package information formatted get_package_info() { pkg_count=$(get_pkg_count) if [ "$pkg_count" -ne 0 ]; then echo -n "$pkg_count" else echo "Unknown" fi } distro() { awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release } storage() { df -h --output=used / | awk 'NR == 2 { print $1 }' } # Get Memory usage get_mem () { free --mega | awk 'NR == 2 { print $3" MB" }' } # Get DE/WM # Reference: https://github.com/unixporn/robbb/blob/master/fetcher.sh get_de_wm() { wm="${XDG_CURRENT_DESKTOP#*:}" [ "$wm" ] || wm="$DESKTOP_SESSION" # for most WMs [ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && { id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null) id=${id##* } wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t 2>/dev/null | grep '^_NET_WM_NAME' | cut -d\" -f 2) } # for non-EWMH WMs [ ! "$wm" ] || [ "$wm" = "LG3D" ] && { wms=('sway' 'kiwmi' 'wayfire' 'sowm' 'catwm' 'fvwm' 'dwm' '2bwm' 'monsterwm' 'tinywm' 'xmonad') for current_wm in "${wms[@]}"; do if pgrep -x "$current_wm" 2>/dev/null >&2; then wm="${current_wm}"; break fi done } echo "${wm:-unknown}" } cat << EOF ${CBD}${c1}█${c2}█ ${c3}█${c4}█${c5}█${c4}█${c6}█${c7}█${c8}█${c9}█${c10}█${c11}█${c12}█ ${c13}█${c14}█ ${c15}█${c16}█${c17}█${c18}█${c19}█${c19}█${c20}█${c21}█${c22}█${c19}█${c19}█${c23}█${c24}█${c36}█${c25}█${c26}█${c27}█ ${c28}█${c29}█${c30}█${c31}█${c32}█${c33}█${c34}█${c34}█${c34}█${c34}█${c34}█${c34}█${c34}█${c35}█${c37}█${c38}█${c39}█${c40}█${c41}█${c42}█${c43}█ ${c5}█${c44}█${c45}█${c46}█${c47}█${c48}█${c49}█${c50}█${c51}█${c52}█${c53}█${c53}█${c53}█${c53}█${c53}█${c53}█${c54}█${c55}█${c56}█${c57}█${c58}█${c59}█${c60}█ ${CMA}os${CWH} $(distro) ${c61}█${c62}█${c38}█${c63}█${c64}█${c34}█${c65}█${c66}█${c67}█${c68}█${c69}█${c70}█${c70}█${c70}█${c71}█${c72}█${c73}█${c74}█${c75}█${c76}█${c77}█${c78}█${c79}█ ${CGR}ker${CWH} $(uname -r) ${c61}█${c62}█${c40}█${c80}█${c81}█${c82}█${c83}█${c84}█${c85}█${c84}█${c86}█${c87}█${c88}█${c88}█${c89}█${c90}█${c85}█${c85}█${c91}█${c92}█${c93}█${c78}█${c41}█${c94}█${c95}█ ${CCY}pkgs${CWH} $(get_package_info) ${c96}█${c97}█${c81}█${c98}█${c99}█${c100}█${c101}█${c102}█${c103}█${c104}█${c105}█${c106}█${c107}█${c108}█${c109}█${c110}█${c111}█${c112}█${c113}█${c114}█${c115}█ ${CBL}sh${CWH} ${SHELL##*/} ${CYE}󰮯 ${CYE} ${CGR}󰊠 ${CGR} ${CBL}󰊠 ${CBL} ${CRE}󰊠 ${CRE} ${CCY}󰊠 ${CCY} ${CMA}󰊠 ${CMA} ${c116}█${c117}█${c99}█${c118}█${c119}█${c120}█${c121}█${c122}█${c123}█${c124}█${c125}█${c126}█${c127}█${c128}█${c111}█${c112}█${c129}█ ${CYE}ram${CWH} $(get_mem) ${c116}█${c70}█${c130}█${c131}█${c131}█${c132}█${c133}█${c134}█${c135}█${c135}█${c136}█${c137}█${c138}█${c131}█${c139}█${c140}█${c141}█ ${CRE}de/wm${CWH} $(get_de_wm) ${c142}█${c143}█${c144}█${c145}█${c146}█${c147}█${c148}█${c149}█${c150}█${c151}█${c152}█${c71}█${c159}█ ${CMA}init${CWH} $(get_init) ${c153}█${c154}█${c155}█${c156}█${c157}█${c158}█${c160}█${c135}█${c135}█${c161}█${c162}█${c163}█${c164}█${c165}█${c166}█${c167}█${c168}█ ${CBL}disk${CWH} $(storage) Used ${c169}█${c170}█${c171}█${c172}█${c173}█${c174}█${c175}█${c176}█${c177}█${c157}█${c178}█${c179}█${c180}█${c181}█${c181}█${c135}█${c135}█${c182}█${c183}█${c184}█${c185}█ ${CYE}up${CWH} $(get_uptime) ${c186}█${c187}█${c187}█${c188}█${c135}█${c135}█${c189}█${c190}█${c191}█${c192}█${c193}█${c194}█${c195}█${c196}█${c197}█${c198}█${c199}█${c135}█${c135}█${c200}█${c201}█${c202}█${c202}█${c203}█${c204}█ ${c205}█${c206}█${c207}█${c207}█${c207}█${c202}█${c208}█${c209}█${c210}█${c135}█${c211}█${c212}█${c213}█${c214}█${c215}█${c216}█${c217}█${c135}█${c135}█${c135}█${c135}█${c218}█${c219}█${c220}█${c220}█${c207}█${c221}█${c222}█${c168}█${rst} EOF