all repos — dotfiles @ 128eb5ed6afb4410c7206bd3a245da2b64bf63dd

my *nix dotfiles

Fix info script to align correctly

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Fri, 13 Sep 2019 19:16:51 +0530
commit

128eb5ed6afb4410c7206bd3a245da2b64bf63dd

parent

61b4f17b3d8ad52e14242f5e680f09350df11a4d

2 files changed, 81 insertions(+), 60 deletions(-)

jump to
D bin/icyinfo.sh

@@ -1,60 +0,0 @@

-#!/usr/bin/env bash -# icyinfo, but better - -BLK="\e[30m" -RED="\e[31m" -GRN="\e[32m" -YLW="\e[33m" -BLU="\e[34m" -PUR="\e[35m" -CYN="\e[36m" -BRED="\e[31m" -BGRN="\e[32m" -BYLW="\e[33m" -BBLU="\e[34m" -BPUR="\e[35m" -BCYN="\e[36m" -WHT="\e[37m" -RST="\e[0m" - -BAR="▁▁▁▁" -COLOR_BARS="$RED$BAR$GRN$BAR$YLW$BAR$BLU$BAR$PUR$BAR$CYN$BAR$RST" - -user=$(whoami) -host=$(hostname) -kernel=$(uname -r) -uptime=$(uptime -p) # too long to print -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 -} - - -os -wm - -clear -printf "$COLOR_BARS\n\n" -printf "${CYN}$user${RST}@${CYN}$host${RST} ${CYN} |\___/|${RST}\n" -printf " ${CYN}/ \\ ${RST} \n" -printf " ${CYN}/__${RST}${PUR}^ ^${RST}${CYN}__\\ ${RST} \n" -printf " ${CYN}\o/ ${RST}\n\n" -printf "os: ${CYN}$os${RST}\n" -printf "kernel: ${CYN}$kernel${RST}\n" -# printf "uptime: ${CYN}$uptime${RST}\n" -printf "wm: ${CYN}$wm${RST}\n" -printf "shell: ${CYN}$shell${RST}\n" -printf "$COLOR_BARS\n"
A bin/info

@@ -0,0 +1,81 @@

+#!/usr/bin/env bash +# icyinfo, but better + +BLK="\e[30m" +RED="\e[31m" +GRN="\e[32m" +YLW="\e[33m" +BLU="\e[34m" +PUR="\e[35m" +CYN="\e[36m" +BRED="\e[31m" +BGRN="\e[32m" +BYLW="\e[33m" +BBLU="\e[34m" +BPUR="\e[35m" +BCYN="\e[36m" +WHT="\e[37m" +RST="\e[0m" + +BAR="▁▁▁▁" +((LEN = ${#BAR} * 6)) +COLOR_BARS="$RED$BAR$GRN$BAR$YLW$BAR$BLU$BAR$PUR$BAR$CYN$BAR$RST" + +user=$(whoami) +host=$(hostname) +kernel=$(uname -r) +uptime=$(uptime -p) # too long to print +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 +} + + +os +wm + +COL=$(tput cols) +ROW=$(tput lines) +((PADY = ROW / 2 - 1 - ${#ENTS[@]} / 2)) +((PADX = COL / 2 - LEN / 2)) + +for ((i = 0; i < PADX; ++i)); do + PADC="$PADC " +done + +for ((i = 0; i < PADY; ++i)); do + PADR="$PADR\n" +done + +clear + +printf "%b" "$PADR" +printf "%s%b" "$PADC" "$COLOR_BARS\n\n" + +printf "%s%b" "$PADC" "${CYN}$user${RST}@${CYN}$host${RST} ${CYN} |\___/|${RST}\n" +printf "%s%b" "$PADC" " ${CYN}/ \\ ${RST} \n" +printf "%s%b" "$PADC" " ${CYN}/__${RST}${PUR}^ ^${RST}${CYN}__\\ ${RST} \n" +printf "%s%b" "$PADC" " ${CYN}\o/ ${RST}\n\n" +printf "%s%b" "$PADC" "os: ${CYN}$os${RST}\n" +printf "%s%b" "$PADC" "kernel: ${CYN}$kernel${RST}\n" +#printf "%s%b" "$PADC" "uptime: ${CYN}$uptime${RST}\n" +printf "%s%b" "$PADC" "wm: ${CYN}$wm${RST}\n" +printf "%s%b" "$PADC" "shell: ${CYN}$shell${RST}\n" +printf "%s%b" "$PADC" "$COLOR_BARS\n" + +tput civis +read -n 1 +tput cnorm