mirror of https://github.com/Flinner/dots.git
				
				
				
			
		
			
				
	
	
		
			118 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
#!/usr/bin/env bash
 | 
						|
# Tiny colored fetch script
 | 
						|
# Requires Typicons Font to display the icons
 | 
						|
 | 
						|
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
 | 
						|
d=$'\e[1m'
 | 
						|
t=$'\e[0m'
 | 
						|
v=$'\e[7m'
 | 
						|
 | 
						|
# Items
 | 
						|
sep=
 | 
						|
s=$d$f0$sep$t
 | 
						|
 | 
						|
#w=
 | 
						|
w=
 | 
						|
netname="$(nmcli -g common | grep -m 1 connected | awk '{print($4)}')"
 | 
						|
[[ -z $netname ]] && netname="no wifi"
 | 
						|
 | 
						|
h=
 | 
						|
wmname="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep -m 1 "WM_NAME" | cut -f2 -d \")"
 | 
						|
 | 
						|
k=
 | 
						|
kernel="$(uname -r | cut -d '-' -f1)"
 | 
						|
 | 
						|
r=
 | 
						|
resolution="$(xwininfo -root | grep geometry | awk '{print $2}' | cut -d + -f1)"
 | 
						|
 | 
						|
sh=
 | 
						|
shell=$(basename $SHELL)
 | 
						|
 | 
						|
# set the eyes, ^.^ by default
 | 
						|
eyes() {
 | 
						|
if [[ -z $1 ]]; then
 | 
						|
    echo "^.^"
 | 
						|
elif [[ $1 = "0" ]]; then
 | 
						|
    echo ". ."
 | 
						|
elif [[ $1 = "1" ]]; then
 | 
						|
    echo "· ·"
 | 
						|
elif [[ $1 = "2" ]]; then
 | 
						|
    echo "^ ^"
 | 
						|
elif [[ $1 = "3" ]]; then
 | 
						|
    echo "- -"
 | 
						|
elif [[ $1 = "4" ]]; then
 | 
						|
    echo "~ ~"
 | 
						|
elif [[ $1 = "5" ]]; then
 | 
						|
    echo "* *"
 | 
						|
elif [[ $1 = "6" ]]; then
 | 
						|
    echo "^.^"
 | 
						|
elif [[ $1 = "7" ]]; then
 | 
						|
    echo "-.-"
 | 
						|
elif [[ $1 = "8" ]]; then
 | 
						|
    echo "~.~"
 | 
						|
elif [[ $1 = "9" ]]; then
 | 
						|
    echo "*.*"
 | 
						|
elif [[ $1 = "10" ]]; then
 | 
						|
    echo "0.0"
 | 
						|
elif [[ $1 = "11" ]]; then
 | 
						|
    echo "0 0"
 | 
						|
elif [[ $1 = "12" ]]; then
 | 
						|
    echo "o o"
 | 
						|
elif [[ $1 = "13" ]]; then
 | 
						|
    echo "o.o"
 | 
						|
else
 | 
						|
    echo "^.^"
 | 
						|
fi
 | 
						|
}
 | 
						|
 | 
						|
# sysinfo with cute kitty
 | 
						|
kittyfetch() {
 | 
						|
printf "            $d$f1$h  $t$wmname
 | 
						|
   /\_/\    $f3$k  $t$kernel
 | 
						|
  ( $d$(eyes $1)$t )   $f2$sh  $t$shell
 | 
						|
   $f1>$t $f3^$t $f1<$t    $f5$r  $t$resolution
 | 
						|
            $f4$w  $t$netname
 | 
						|
"
 | 
						|
uptime --pretty
 | 
						|
}
 | 
						|
 | 
						|
# sysinfo with cute bunny
 | 
						|
bunnyfetch() {
 | 
						|
printf "             $d$f1$h  $t$wmname
 | 
						|
   (\ /)     $f3$k  $t$kernel
 | 
						|
   ( $d$(eyes $1)$t)    $f2$sh  $t$shell
 | 
						|
   c($f1\"$t)($f1\"$t)   $f5$r  $t$resolution
 | 
						|
             $f4$w  $t$netname
 | 
						|
"
 | 
						|
uptime --pretty
 | 
						|
}
 | 
						|
 | 
						|
# script information
 | 
						|
scriptinfo() {
 | 
						|
printf "cutefetch - simple colored script to display system info
 | 
						|
Usage: cutefetch kitty/bunny
 | 
						|
If no argument is given, kitty is assumed.
 | 
						|
If unknown argument is given, this message is shown.
 | 
						|
"
 | 
						|
}
 | 
						|
 | 
						|
# print the fetch info, kitty by default, bunny otherwise
 | 
						|
cutefunc() {
 | 
						|
if [[ -z $1 ]] || [[ $1 = "kitty" ]] || [[ $1 = "k" ]]; then
 | 
						|
    kittyfetch $2
 | 
						|
elif [[ $1 = "bunny" ]] || [[ $1 = "b" ]]; then
 | 
						|
    [[ -z $2 ]] && eye="0" || eye=$2
 | 
						|
    bunnyfetch $eye
 | 
						|
else
 | 
						|
    [[ $1 == ?(-)+([0-9]) ]] && kittyfetch $1 || scriptinfo
 | 
						|
fi
 | 
						|
}
 | 
						|
 | 
						|
# call the main function
 | 
						|
cutefunc $1 $2
 |