Skip to content

Instantly share code, notes, and snippets.

@Apeiros-46B
Last active September 19, 2021 21:46
Show Gist options
  • Save Apeiros-46B/69832a7152f029d0ae793b672a2f97ae to your computer and use it in GitHub Desktop.
Save Apeiros-46B/69832a7152f029d0ae793b672a2f97ae to your computer and use it in GitHub Desktop.
Fetch utility. "sing" and the code for color printing are from https://github.com/Manas140/sh, and wmctrl is needed for detecting the window manager.
#!/bin/bash
c1="\033[1;30m"
c2="\033[1;31m"
c3="\033[1;32m"
c4="\033[1;33m"
c5="\033[1;34m"
c6="\033[1;35m"
c7="\033[1;36m"
c8="\033[1;37m"
end="\033[1;0m"
e1="dist"
e2="krnl"
e3="init"
e4="shll"
e5="winm"
distro=$(cat /etc/os-release | grep ID | awk -F= '{ print $2 }' | head -1)
kernel=$(uname -r)
init=""
if init --version > /dev/null; then
init=$(init --version | head -1 | awk '{ print $2 }' | awk -F\( '{ print $1 }')
else
init=$(stat /sbin/init | head -1 | awk '{ print $4 }')
fi
windowmanager=$(wmctrl -m | grep Name | awk '{print $2}')
echo -e "$c5$e1 $c6- $(sing $distro)"
echo -e "$c5$e2 $c6- $(sing $kernel)"
echo -e "$c5$e3 $c6- $(sing $init)"
echo -e "$c5$e4 $c6- $(sing $SHELL)"
echo -e "$c5$e5 $c6- $(sing $windowmanager)"
printf "\n$c1▇▇$c2▇▇$c3▇▇$c4▇▇$c5▇▇$c6▇▇$c7▇▇$c8▇▇$end\n\n"
@Apeiros-46B
Copy link
Author

yeah i was gonna work on that

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