bin/icyinfo.sh (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
#!/usr/bin/env bash # icyinfo.sh - displays sys info # colors f=3 b=4 for j in f b; do for i in {0..7}; do printf -v $j$i "%b" "\e[${!j}${i}m" done done bld=$'\e[1m' rst=$'\e[0m' inv=$'\e[7m' # detect user=$(whoami) host=$(hostname) kernel=$(uname -r) shell=$(basename $SHELL) os() { os=$(source /etc/os-release && echo $ID) export os } wm() { id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK) id=${id##* } wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t) wm=${wm/*_NET_WM_NAME = } wm=${wm/\"} wm=${wm/\"*} wm=${wm,,} export wm } init() { init=$(readlink /sbin/init) init=${init##*/} init=${init%%-*} export init } # exec os wm init cat <<EOF $user${f2}@${rst}$host ${f2}os:${rst} ${f7}$os${rst} ┌───┐ ${f2}kernel:${rst} ${f7}$kernel${rst} │${f2}^${rst}_${f2}^${rst}│ ${f2}shell:${rst} ${f7}$shell${rst} └───┘ ${f2}init:${rst} ${f7}$init${rst} ${f2}wm:${rst} ${f7}$wm${rst} EOF # optional blocks if [[ $1 = "-b" ]]; then pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; } printf "\n%s\n%s\n\n" "$(pcs)" "$(pcs '1;')" else : fi |