You are not logged in.

#181 Today 14:54:25

ceeslans
Member
Registered: 2015-09-30
Posts: 207

Re: 2026 Screenshot Thread

@unklar : sorry, I obviously misunderstood.
Here's the ufetch-one script, as well as the wrapper script to set the dimensions and colors

ufetch-one

#!/bin/bash

# Ufetch 
# A simple screenfetch alternative
# Original code from https://github.com/jschx/ufetch
# I just slightly edited Addy's modified version
# Cheers @ceeslans

## Get system info
user="${USER}"
host="$(hostname)"

distro="$(. /etc/os-release; echo ${ID:?} ${VERSION:?})"

kernel="$(uname -sr)"

uptime="$(uptime -p | sed 's/up //')"

packages="$(dpkg -l | grep -c ^i)"
#packages="$(dpkg -l | wc -l)"

shell="$(basename ${SHELL})"

RAM="$(free -h | awk '/^Mem:/ {print $2}')"
mem="$(cat /proc/meminfo | awk ' FNR<=5 || FNR>=21 {a[NR]=$2} END {printf "'%d'Mb\n", (a[1]-a[2]-a[4]-a[5]-a[24])/1024}' )"
#RAM="$(free -h | awk '/^Mem:/ {print $3 "/" $2}')"

if [ -z "${WM}" ]; then
	if [ "${XDG_CURRENT_DESKTOP}" ]; then
		envtype='DE'
		WM="${XDG_CURRENT_DESKTOP}"
	#elif [ "${DESKTOP_SESSION}" ]; then
	#	envtype='DE'
	#	WM="${DESKTOP_SESSION}"
	else
		envtype='WM'
		WM="${XDG_SESSION_DESKTOP}"
		# WM="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
	fi
else
	envtype='WM'
fi

## Define Colours
if [[ $1 = "--red" ]]; then
    bgaccent="$(tput setab 1)"
    accent="$(tput setaf 1)"
elif [[ $1 = "--green" ]]; then
    bgaccent="$(tput setab 2)"
    accent="$(tput setaf 2)"
elif [[ $1 = "--yellow" ]]; then
    bgaccent="$(tput setab 3)"
    accent="$(tput setaf 3)"
elif [[ $1 = "--blue" ]]; then
    bgaccent="$(tput setab 4)"
    accent="$(tput setaf 4)"
elif [[ $1 = "--magenta" ]]; then
    bgaccent="$(tput setab 5)"
    accent="$(tput setaf 5)"
else
    bgaccent="$(tput setab 7)"
    accent="$(tput setaf 7)"
fi

bold="$(tput bold)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"
cbg="${reset}${bold}${bgaccent}${white}"
cr="${reset}"
c0="${reset}${bold}"
c1="${reset}${accent}"

## Output

cat <<EOF

 ${c0} ${cbg} ${c1}   USER      ${cr}${user} @ ${c1}${host}${reset}
 ${c0} ${cbg} ${c1}   DISTRO    ${cr}${distro}${reset}
 ${c0} ${cbg} ${c1}   KERNEL    ${cr}${kernel}${reset}
 ${c0} ${cbg} ${c1}   UPTIME    ${cr}${uptime}${reset}
 ${c0} ${cbg} ${c1}   ${envtype}        ${cr}${WM}${reset}
 ${c0} ${cbg} ${c1}   SHELL     ${cr}${shell}${reset}
 ${c0} ${cbg} ${c1}   PACKAGES  ${cr}${packages}${reset}
 ${c0} ${cbg} ${c1}   MEMORY    ${cr}${mem} / ${RAM}${reset}
EOF

ufetch (wrapper script)

#!/bin/bash

### uncomment preferred terminal emulator to execute this script

if [[ $1 = "red" ]]; then
    color="--red"
elif [[ $1 = "green" ]]; then
    color="--green"
elif [[ $1 = "yellow" ]]; then
    color="--yellow"
elif [[ $1 = "blue" ]]; then
    color="--blue"
elif [[ $1 = "magenta" ]]; then
    color="--magenta"
else
    color="--white"
fi

#term="urxvt -uc --internalBorder 10 --borderLess --cursorColor black"
term="roxterm --hide-menubar --borderless"

###----------------------------------------------------

$term --title "ufetch" --geometry 44x10+40+65  -e /bin/bash -c "ufetch-one $color ; read -n1 "

Offline

#182 Today 15:13:22

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,866

Re: 2026 Screenshot Thread

^^Yes, I didn't mean the Conky.  big_smile
Thank you for the script and the script wrapper.

+1

Offline

Board footer

Powered by FluxBB