all repos — dotfiles @ c1bf4f2effbd7412bb0cd37d7e8586501f8663c1

my *nix dotfiles

bin/icyinfo.sh (view raw)

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