Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sctech-tr committed Sep 2, 2024
1 parent 37ca12a commit c7f97f4
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SHELL = /bin/sh

INSTALL_DIR = /usr/bin/
IN_NAME = betterfetch.sh
OUT_NAME = betterfetch

help:
@echo "make install install betterfetch"
@echo "make uninstall remove betterfetch."
@echo "make rmconfig remove betterfetch configuration files."

install:
cp ${IN_NAME} ${INSTALL_DIR}${OUT_NAME}
[ -e /etc/zshrc ] || cp betterfetchrc /etc/betterfetchrc
cp betterfetch-version /etc/betterfetch-version

uninstall:
rm ${INSTALL_DIR}${OUT_NAME}

rmconfig:
rm /etc/betterfetchrc
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# betterfetch 📜
## What's betterfetch?
betterfetch is a fetch script used to quickly show system information in terminal. it's a fork of <a href="https://github.com/emilydaemon/zfetch">zfetch</a>.
## What does it show?
currently it shows this information:
- your username and your machine name.
- your os.
- your kernel.
- machine uptime.
- terminal shell.
- desktop environment
- terminal emulator
- 7 colored dots to identify terminal colors.
## Installation 🔧
### Linux / macOS
run this:
```
git clone https://github.com/sctech-tr/betterfetch.git && cd betterfetch && sudo make install
```
### Windows
no windows support. use linux. (probably because i hate windows and there is no visual studio for linux)
Empty file added betterfetch-version
Empty file.
56 changes: 56 additions & 0 deletions betterfetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh
# shellcheck source=/dev/null
# shellcheck disable=SC2059

# yes. no logos. because why not?

# source the config file
if [ "$colorsoff" = "" ]; then
colorsoff=0
fi

[ -e /etc/betterfetchrc ] && . /etc/betterfetchrc 2> /dev/null
[ -e ~/.betterfetchrc ] && . ~/.betterfetchrc 2> /dev/null

REPO="sctech-tr/betterfetch"
CURRENT_VERSION_FILE="/etc/betterfetch-version" # Path to the file containing the current version
GITHUB_API="https://api.github.com/repos/$REPO/releases/latest"

# Fetch the latest release version from GitHub
LATEST_VERSION=$(curl -s $GITHUB_API | jq -r '.tag_name')

# Read the current version from the version file
if [ -f "$CURRENT_VERSION_FILE" ]; then
CURRENT_VERSION=$(cat "$CURRENT_VERSION_FILE")
else
echo "error: current version file not found."
exit 1
fi

if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
echo "betterfetch ($LATEST_VERSION) is available! you are currently on version $CURRENT_VERSION."
exit 0
fi


# the meat and potatoes, actual fetch

# only set these if they are not already set by the config file
[ -z "$os" ] && . /etc/os-release 2>/dev/null || export os="Unknown"
[ -z "$host" ] && host=$(cat /proc/sys/kernel/hostname)
[ -z "$kernel" ] && kernel=$(sed "s/version // ; s/ (.*//" /proc/version)
[ -z "$uptime" ] && uptime=$(uptime -p 2>/dev/null | sed "s/up //")
[ -z "$shell" ] && shell=$(printf "$SHELL" | sed "s/\/bin\///" | sed "s/\/usr//")
[ -z "$de" ] && de=$(echo $XDG_CURRENT_DESKTOP)
[ -z "$terminal" ] && terminal=$(ps -o comm= -p $(ps -o ppid= -p $$))

printf "$USER@$host\n"
printf "OS ${nc} $os\n"
printf "Kernel ${nc} $kernel\n"
printf "Uptime ${nc} $uptime\n"
printf "Shell ${nc} $shell\n"
printf "DE ${nc} $de\n"
printf "Terminal ${nc} $terminal\n"
if [ "$colorsoff" != 1 ]; then
printf "${dslogo6}\033[0;31m● \033[0;32m● \033[0;33m● \033[0;34m● \033[0;35m● \033[0;36m● \033[0;37m●\033[0m\n"
fi
13 changes: 13 additions & 0 deletions betterfetchrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# If you'd like the colored dots at the bottom of the fetch to be removed, you
# may do so here.
# By default, they are enabled.
#colorsoff=1

# Define custom information here!
#host=MyAwesomePC
#os=MyDistro
#kernel=CustomAwesomeKernel
#uptime=478247238472
#shell=mysh
#de=CustomDE
#terminal=konsole

0 comments on commit c7f97f4

Please sign in to comment.