commit e8194a492212685f37d8bcd579c16c2650028981
parent 18bfe6e7f18d4feb221215b7bac927d920c75839
Author: pyratebeard <root@pyratebeard.net>
Date: Mon, 24 Aug 2020 12:43:23 +0100
modified sysinfo
Diffstat:
M | bin/bin/sysinfo | | | 57 | +++++++++++++++++++++++++++++++-------------------------- |
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/bin/bin/sysinfo b/bin/bin/sysinfo
@@ -1,4 +1,6 @@
#!/bin/sh
+## author: pyratebeard <root@pyratebeard.net>
+## original author: xero <x@xero.nu>
#█▓▒░ vars
#FULL=▓
#EMPTY=░
@@ -10,14 +12,19 @@ EMPTY=┄
name=$USER
host=$(hostname)
+uptime=$(uptime -p | cut -b4- | tr -d ',|eeks|ay|our|inute')
battery=/sys/class/power_supply/BAT1
-distro="arch linux"
-kernel=$(uname -r)
+distro=$(grep -E "^ID=" /etc/os-release | awk -F= '{print $2}')
pkgs=$(pacman -Qqs | wc -l)
-colors='futuremyth'
-font='tamzen'
-wm='2bwm'
upgrade=$(sudo pacman -Sy >/dev/null ; pacman -Qu | wc -l)
+kernel=$(uname -r)
+shell=$(echo $SHELL | awk -F/ '{print $NF}')
+term=$TERM
+colors=$(grep urxvt-colors ~/.Xdefaults | awk -F\/ '{print $NF}' | tr -d '"')
+font=$(grep -Ei "^urxvt\*font" ~/.Xdefaults | awk -F: '{print $3}')
+font_size=$(grep -Ei "^urxvt\*font" ~/.Xdefaults | grep -Eo '[0-9]{1,2}')
+#wm=$XDG_SESSION_DESKTOP
+wm='2bwm'
#█▓▒░ progress bar
draw()
@@ -42,37 +49,35 @@ draw()
#█▓▒░ colors
printf "\n"
-i=0
-while [ $i -le 6 ]
-do
- printf "\e[$((i+41))m\e[$((i+30))m█▓▒░"
- i=$(($i+1))
-done
-printf "\e[37m█\e[0m▒░\n\n"
-
+~/bin/blocks1
+printf "\n"
#█▓▒░ greets
-printf " \e[0m hello \e[36m$name\033[0m, i'm \e[34m$host\n"
+printf " \e[1;34m user \e[30m\\\\\ \e[36m$name\n"
+printf " \e[1;34m host \e[30m\\\\\ \e[32m$host\n"
+printf " \e[1;34m up \e[30m\\\\\ \e[37m$uptime\n"
printf " \e[0m\n"
#█▓▒░ environment
-printf " \e[1;33m distro \e[0m$distro\n"
-printf " \e[1;33m kernel \e[0m$kernel\n"
-printf " \e[1;33m packages \e[0m$pkgs\n"
-printf " \e[1;33m upgrade \e[0m$upgrade\n"
-printf " \e[1;33m wm \e[0m$wm\n"
-printf " \e[1;33m font \e[0m$font\n"
-printf " \e[1;33m colors \e[0m$colors\n"
+printf " \e[1;34m distro \e[30m\\\\\ \e[0m$distro\n"
+printf " \e[1;34m kernel \e[30m\\\\\ \e[0m$kernel\n"
+printf " \e[1;34mpackages \e[30m\\\\\ \e[0m$pkgs\n"
+printf " \e[1;34m upgrade \e[30m\\\\\ \e[0m$upgrade\n"
+printf " \e[1;34m wm \e[30m\\\\\ \e[0m$wm\n"
+printf " \e[1;34m shell \e[30m\\\\\ \e[0m$shell\n"
+printf " \e[1;34m term \e[30m\\\\\ \e[0m$term\n"
+printf " \e[1;34m font \e[30m\\\\\ \e[0m$font $font_size\n"
+printf " \e[1;34m colors \e[30m\\\\\ \e[0m$colors\n"
printf " \e[0m\n"
#█▓▒░ cpu
cpu=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}')
c_lvl=`printf "%.0f" $cpu`
-printf " \e[0;36m%-4s \e[1;36m%-5s %-25s \n" " cpu" "$c_lvl%" `draw $c_lvl 15`
+printf " \e[0;36m%-4s \e[1;36m%-5s %-25s \n" " cpu" "$c_lvl%" `draw $c_lvl 15`
#█▓▒░ ram
ram=`free | awk '/Mem:/ {print int($3/$2 * 100.0)}'`
-printf " \e[0;36m%-4s \e[1;36m%-5s %-25s \n" " ram" "$ram%" `draw $ram 15`
+printf " \e[0;36m%-4s \e[1;36m%-5s %-25s \n" " ram" "$ram%" `draw $ram 15`
#█▓▒░ battery
if [ -f $battery/charge_full ] ; then
@@ -90,18 +95,18 @@ if [ -f $battery/charge_full ] ; then
color='36'
;;
esac
- printf " \e[0;${color}m%-4s \e[1;${color}m%-5s %-25s \n" " bat" "$charge%" `draw $charge 15 $color`
+ printf " \e[0;${color}m%-4s \e[1;${color}m%-5s %-25s \n" " bat" "$charge%" `draw $charge 15 $color`
fi
#█▓▒░ volume
-vol=`amixer get Master | awk '$0~/%/{print $4}' | head -n1 | tr -d '[]%'`
+vol=`amixer get Master | awk '$0~/%/{print $5}' | head -n1 | tr -d '[]%'`
if amixer get Master | grep -q '\[off\]'
then
color='31'
else
color='36'
fi
-printf " \e[0;${color}m%-4s \e[1;${color}m%-5s %-25s \n" " vol" "$vol%" `draw $vol 15 $color`
+printf " \e[0;${color}m%-4s \e[1;${color}m%-5s %-25s \n" " vol" "$vol%" `draw $vol 15 $color`
#█▓▒░ temperature
#temp=`sensors | awk '/Core\ 0/ {gsub(/\+/,"",$3); gsub(/\..+/,"",$3) ; print $3}'`