Initial commit
commit
8ac1236294
@ -0,0 +1,14 @@
|
||||
# 'Lil Fetch
|
||||
## A tiny little fetch tool
|
||||
|
||||
This script outputs system information to a terminal and a coloured bar to show off your terminal colours.
|
||||
|
||||
It is designed to work on my system, and thus may produce unexpected results on other platforms. If you encounter any problems, please post them as an issue together with some information about your system so that I can fix the issue.
|
||||
|
||||
# Usage
|
||||
|
||||
Simply place the `lfetch` file in a location that is in your PATH. Run `lfetch` to start the script.
|
||||
|
||||
# Customization
|
||||
|
||||
All customization can be done by modifying the script. The entries and their colours are defined between line 51 and 63.
|
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 'Lil Fetch
|
||||
# A tiny little fetch tool
|
||||
# By Kat Hamer
|
||||
|
||||
# Get RAM used
|
||||
ram_used() {
|
||||
awk '/^Mem/ {print $3}' <(free -m)
|
||||
}
|
||||
|
||||
# Get total RAM
|
||||
ram_total() {
|
||||
awk '/^Mem/ {print $2}' <(free -m)
|
||||
}
|
||||
|
||||
# Get WM name (Requires wmctrl to be installed!)
|
||||
wm_name() {
|
||||
awk '/Name:/ {print $2}' <(wmctrl -m)
|
||||
}
|
||||
|
||||
# Store OS info (DOES NOT WORK ON ALL SYSTEMS!)
|
||||
os_info() {
|
||||
source /etc/os-release
|
||||
}
|
||||
|
||||
# Get shell version
|
||||
shell_version() {
|
||||
case $(basename $SHELL) in
|
||||
"bash")
|
||||
echo "Bash $BASH_VERSION"
|
||||
;;
|
||||
"zsh")
|
||||
echo "$(zsh --version)"
|
||||
;;
|
||||
*)
|
||||
echo "$SHELL"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get uptime
|
||||
uptime() {
|
||||
uptime | gawk '{ printf $1 }'
|
||||
}
|
||||
|
||||
display_bar() {
|
||||
echo -e "\e[41m \e[42m \e[43m \e[44m \e[45m \e[46m \e[47m \e[0m"
|
||||
}
|
||||
|
||||
output_color() {
|
||||
os_info
|
||||
accent_ansi="\e[0;36m"
|
||||
reset_ansi="\e[0m"
|
||||
|
||||
echo -e "$accent_ansi$(whoami)$reset_ansi@$accent_ansi$(hostname)$reset_ansi in $accent_ansi$(pwd)$reset_ansi"
|
||||
echo -e "OS: $accent_ansi$NAME$reset_ansi"
|
||||
echo -e "RAM: $accent_ansi$(ram_used) MB$reset_ansi/$accent_ansi$(ram_total)$reset_ansi MB"
|
||||
echo -e "Shell: $accent_ansi$(shell_version)$reset_ansi"
|
||||
echo -e "WM: $accent_ansi$(wm_name)$reset_ansi"
|
||||
echo
|
||||
display_bar
|
||||
}
|
||||
|
||||
|
||||
output_plain() {
|
||||
os_info
|
||||
|
||||
echo -e "$(whoami)@$(hostname) in $(pwd)$"
|
||||
echo -e "OS: $NAME"
|
||||
echo -e "RAM: $(ram_used) MB/$(ram_total) MB"
|
||||
echo -e "Shell: $(shell_version)"
|
||||
echo -e "WM: $(wm_name)"
|
||||
}
|
||||
|
||||
main() {
|
||||
output_color
|
||||
}
|
||||
|
||||
# Call main function
|
||||
main
|
||||
|
Loading…
Reference in New Issue