all repos — dotfiles @ 3a6fbca7b4f810ba4a1fbccd7043be3e94ebcb0e

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	export wm
45}
46
47pkgs() {
48    pkgs=$(apk info | wc -l)
49    export pkgs
50}
51
52# get our vars
53os
54wm
55pkgs
56
57COL=$(tput cols)
58ROW=$(tput lines)
59((PADY = ROW / 2 - 1 - ${#ENTS[@]} / 2))
60((PADX = COL / 2 - LEN / 2))
61
62for ((i = 0; i < PADX; ++i)); do
63    PADC="$PADC "
64done
65
66for ((i = 0; i < PADY; ++i)); do
67    PADR="$PADR\n"
68done
69
70clear
71
72printf "%b" "$PADR"
73
74#printf "%s%b" "$PADC" "┏┓╋╋╋╋╋┏┓      \n" 
75#printf "%s%b" "$PADC" "┣╋━┳┳┳━┫┗┳━┳┳┓ \n"
76#printf "%s%b" "$PADC" "┃┃━┫┃┃╋┃┃┃╋┣┃┫ \n"
77#printf "%s%b" "$PADC" "┗┻━╋┓┃┏┻┻┻━┻┻┛ \n"
78#printf "%s%b" "$PADC" "╋╋╋┗━┻┛\n\n"
79
80#printf "%s%b" "$PADC" "$COLOR_BARS\n\n"
81printf "%s%b" "$PADC" "${CYN}$user${RST}@${CYN}$host${RST}\n"
82printf "%s%b" "$PADC" "os:               ${CYN}$os${RST}\n"
83printf "%s%b" "$PADC" "kernel:${CYN}$kernel${RST}\n"
84printf "%s%b" "$PADC" "pkgs:                ${CYN}$pkgs${RST}\n"
85printf "%s%b" "$PADC" "wm:                   ${CYN}$wm${RST}\n"
86printf "%s%b" "$PADC" "shell:              ${CYN}$shell${RST}\n"
87printf "%s%b" "$PADC" "$COLOR_BARS\n"
88
89tput civis
90read -n 1
91tput cnorm