Skip to content

Instantly share code, notes, and snippets.

@cybardev
Last active February 2, 2021 16:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cybardev/90a4bd98f8820424ac0be62aaae3f480 to your computer and use it in GitHub Desktop.
Simple, cute pfetch/ufetch alternative by elenapan, with some modifications to suit my case
#!/usr/bin/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=
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)
# /\_/\
# ( o.o )
# > ^ <
# /\_/\
# ( ·.· )
# > ^ <
# /\_/\
# ( -.- )
# > ^ <
tput clear
cat << EOF
$d$f1$h $t$wmname
/\_/\ $f3$k $t$kernel
( $d^.^$t ) $f2$sh $t$shell
$f1>$t $f3^$t $f1<$t $f5$r $t$resolution
$f4$w $t$netname
EOF
@cybardev
Copy link
Author

cybardev commented Feb 1, 2021

How it looks:

image

Changes made:

  • line 1: changed shebang from #!/bin/bash to #!/usr/bin/bash (personal preference)
  • line 20: changed the variable name from wifiname to netname
  • line 20: changed the command that gets network name to show wired connection when available
  • line 21: added a condition for when not connected to the internet
  • line 24: added -m 1 flag to grep to avoid printing multiple instances of wmname (in my case I had two - xfce4 and Xfce4)
  • lines 35-54: changed code to display a kitty instead of a bunny

Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment