From af120ab348f2e1a5a39dec035ed9dcf84189a64e Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Mon, 3 Oct 2022 21:42:20 +0530 Subject: dotfiles --- scripts/fetch | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 scripts/fetch (limited to 'scripts/fetch') diff --git a/scripts/fetch b/scripts/fetch new file mode 100755 index 0000000..a0381e6 --- /dev/null +++ b/scripts/fetch @@ -0,0 +1,77 @@ +#!/bin/bash +clear +c=3 b=4 +for j in c b; do + for i in {0..7}; do + printf -v $j$i "%b" "\e[${!j}${i}m" + done +done + +user=$(whoami) +host=$(uname -a | awk '{print $2}') +memory=$(free -h) +os=$(source /etc/os-release && echo $PRETTY_NAME) +kernel=$(uname -sr) +wm="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \")" +mem=$(free -m | sed -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p') +pkgs="$(xbps-query -l | wc -l)" +shell=$(echo "$SHELL" | awk -F/ '{for ( i=1; i <= NF; i++) sub(".", substr(toupper($i),1,1) , $i); print $NF}') +colors=$(for i in {0..7}; do echo -en "\e[${1}$((30 + $i))m▁▁▁"; done) + +get_uptime() { + # Uptime works by retrieving the data in total seconds and then + # converting that data into days, hours and minutes using simple + # math. + IFS=. read -r s _