all repos — dotfiles @ 7b11a72879acfe5c41286ca9dbb0533ad8643898

my *nix dotfiles

bin/info (view raw)

 1#!/usr/bin/env bash
 2# icyinfo, but better
 3
 4BLK="\e[30m"
 5RED="\e[31m"
 6GRN="\e[32m"
 7YLW="\e[33m"
 8BLU="\e[34m"
 9PUR="\e[35m"
10CYN="\e[36m"
11BRED="\e[31m"
12BGRN="\e[32m"
13BYLW="\e[33m"
14BBLU="\e[34m"
15BPUR="\e[35m"
16BCYN="\e[36m"
17WHT="\e[37m"
18RST="\e[0m"
19
20BAR="████"
21((LEN = ${#BAR} * 6))
22COLOR_BARS="$RED$BAR$GRN$BAR$YLW$BAR$BLU$BAR$PUR$BAR$CYN$BAR$RST"
23
24user=$(whoami)
25host=$(hostname)
26kernel=$(uname -r)
27#uptime=$(uptime -p)    # too long to print
28shell=$(basename $SHELL)
29
30os() {
31	os=$(source /etc/os-release && echo $ID)
32	export os
33}
34
35
36wm() {
37	id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
38	id=${id##* }
39	wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)
40	wm=${wm/*_NET_WM_NAME = }
41	wm=${wm/\"}
42	wm=${wm/\"*}
43	wm=${wm,,}
44    wm="2bwm"
45	export wm
46}
47
48pkgs() {
49    pkgs="$(kiss l | wc -l)"
50    export pkgs
51}
52
53# get our vars
54os
55wm
56pkgs
57
58
59COL=$(tput cols)
60ROW=$(tput lines)
61((PADY = ROW / 2 - 1 - ${#ENTS[@]} / 2))
62((PADX = COL / 2 - LEN / 2))
63
64for ((i = 0; i < PADX; ++i)); do
65    PADC="$PADC "
66done
67
68for ((i = 0; i < PADY; ++i)); do
69    PADR="$PADR\n"
70done
71
72clear
73
74printf "%b" "$PADR"
75
76printf "%s%b" "$PADC" "┏┓╋╋╋╋╋┏┓      \n" 
77printf "%s%b" "$PADC" "┣╋━┳┳┳━┫┗┳━┳┳┓ \n"
78printf "%s%b" "$PADC" "┃┃━┫┃┃╋┃┃┃╋┣┃┫ \n"
79printf "%s%b" "$PADC" "┗┻━╋┓┃┏┻┻┻━┻┻┛ \n"
80printf "%s%b" "$PADC" "╋╋╋┗━┻┛\n\n"
81
82#printf "%s%b" "$PADC" "$COLOR_BARS\n\n"
83printf "%s%b" "$PADC" "${CYN}$user${RST}@${CYN}$host${RST}\n"
84printf "%s%b" "$PADC" "os:                 ${CYN}$os${RST}\n"
85printf "%s%b" "$PADC" "kernel:       ${CYN}$kernel${RST}\n"
86printf "%s%b" "$PADC" "pkgs:                ${CYN}$pkgs${RST}\n"
87printf "%s%b" "$PADC" "wm:                 ${CYN}$wm${RST}\n"
88printf "%s%b" "$PADC" "shell:              ${CYN}$shell${RST}\n"
89printf "%s%b" "$PADC" "$COLOR_BARS\n"
90
91tput civis
92read -n 1
93tput cnorm