all repos — dotfiles @ ee508dfcedd8a0ac72ea0808f3dd6be4daa39681

my *nix dotfiles

stole and rewrote scripts/icyinfo.sh
icyphox icyph0x@protonmail.com
Sat, 20 Jan 2018 01:19:02 +0530
commit

ee508dfcedd8a0ac72ea0808f3dd6be4daa39681

parent

a4db8e3a26a4db5d2154e56928abc92780a88f01

1 files changed, 57 insertions(+), 44 deletions(-)

jump to
M scripts/scripts/icyinfo.shscripts/scripts/icyinfo.sh

@@ -1,53 +1,66 @@

-#!/bin/bash +#!/usr/bin/env bash +# nrnl.sh - displays sys info -# a system info script written by yours truly -# it's hardcoded stuff, lulz +# 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' -red="\e[31m" -grn="\e[32m" -ylw="\e[33m" -cyn="\e[36m" -blu="\e[34m" -prp="\e[35m" -bprp="\e[35;1m" -rst="\e[0m" +# detect +user=$(whoami) +host=$(hostname) +kernel=$(uname -r) +kernel=${kernel%-*} +kernel=${kernel%_*} +shell=$(basename $SHELL) +os() { + os=$(source /etc/os-release && echo $ID) + export os +} -echo +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 +} -color-echo() -{ # print with colors - echo -e " $cyn$1: $rst$2" +init() { + init=$(readlink /sbin/init) + init=${init##*/} + init=${init%%-*} + export init } -# kernel -color-echo 'kernel' "$(uname -smr)" - -# uptime -up=$(</proc/uptime) -up=${up//.*} # string before first . is seconds -days=$((${up}/86400)) # seconds divided by 86400 is days -hours=$((${up}/3600%24)) # seconds divided by 3600 mod 24 is hours -mins=$((${up}/60%60)) # seconds divided by 60 mod 60 is mins -color-echo "uptime" $days'd '$hours'h '$mins'm' - -# shell -color-echo 'shell' 'zsh' - -# wm -color-echo 'wm' 'xfwm4' - -# distro -color-echo 'distro' 'Arch Linux' +# exec +os +wm +init +cat <<EOF -# ascii art -echo "" -echo " /\ /\ " -echo " \^ ^/ i c y p h o x " -echo " \_/ " -echo "" +$user${f2}@${rst}$host + os${f2}:${rst} ${f7}$os${rst} +┌───┐ kernel${f2}:${rst} ${f7}$kernel${rst} +│${f2}^${rst}_${f2}^${rst}│ shell${f2}:${rst} ${f7}$shell${rst} +└───┘ init${f2}:${rst} ${f7}$init${rst} + wm${f2}:${rst} ${f7}$wm${rst} -# colors -echo -e " $red▓▓$rst $grn▓▓$rst $blu▓▓$rst $ylw▓▓$rst $cyn▓▓$rst $prp▓▓$rst $bprp▓▓$rst" +EOF -echo -echo +# 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