rxfetch icon indicating copy to clipboard operation
rxfetch copied to clipboard

Show your edits in rxfetch

Open Mangeshrex opened this issue 2 years ago • 20 comments

This issue is created for posting/sharing the configs and screenshots for a custom script of rxfetch. This issue is open for everyone to upload there stuff.

Mangeshrex avatar Jul 27 '21 14:07 Mangeshrex

My custom script rxfetch for Termux , you can find my custom script here

rxfetch

nihsx avatar Feb 26 '22 05:02 nihsx

#!/usr/bin/env bash

#colors
#bold="(tput bold)"
magenta="\033[1;35m"
green="\033[1;32m"
white="\033[1;37m"
blue="\033[1;34m"
red="\033[1;31m"
black="\033[1;40;30m"
yellow="\033[1;33m"
cyan="\033[1;36m"
reset="\033[0m"
bgyellow="\033[1;43;33m"
bgwhite="\033[1;47;37m"
c0=${reset}
c1=${magenta}
c2=${green}
c3=${white}
c4=${blue}
c5=${red}
c6=${yellow}
c7=${cyan}
c8=${black}
c9=${bgyellow}
c10=${bgwhite}

# Setup fonts
setup_fonts() {
    os=$(uname -o)
	if [ "$os" = "Android" ]; then
        if [ ! -f "$HOME/.termux/fonts/Material.ttf" ]; then
            cp ttf-material-design-icons/* "$HOME/.termux/fonts/"
            termux-reload-settings
        fi
	elif ! fc-match :family='Material' | grep -Eq '^Material.ttf'; then
		mkdir -p "$HOME/.local/share/fonts"
		cp ttf-material-design-icons/* "$HOME/.local/share/fonts"
		fc-cache -vf &>/dev/null
	fi
}

# Get the init
get_init() {
	os=$(uname -o)
	if [ "$os" = "Android" ]; then
		echo 'init.rc'
	elif pidof -q systemd; then
		echo 'systemd'
	elif [ -f '/sbin/openrc' ]; then
		echo 'openrc'
	else
		cut -d ' ' -f 1 /proc/1/comm
	fi
}

# Get count of packages installed
get_pkg_count() {
	package_managers=('xbps-install' 'apk' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge')
	for package_manager in ${package_managers[@]}; do
		if command -v $package_manager 2>/dev/null>&2; then
			case "$package_manager" in
				xbps-install ) xbps-query -l | wc -l ;;
				apk ) apk search | wc -l ;;
				apt ) apt list --installed 2>/dev/null | wc -l ;;
				pacman ) pacman -Q | wc -l ;;
				nix ) nix-env -qa --installed '*' | wc -l ;;
				dnf ) dnf list installed | wc -l ;;
				rpm ) rpm -qa | wc -l ;;
				emerge ) qlist -I | wc -l ;;
			esac

			# if a package manager is found return from the function
			return
		fi
	done
	echo 'Unknown'
}

# Get distro name
get_distro_name() {
	os=$(uname -o)
	if [ "$os" = "Android" ] ; then
		echo 'Android'
	else
		awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release
	fi
}

# Get root partition space used
get_storage_info() {
	df -h --output=used,size /home | awk 'NR == 2 { print $1" / "$2 }'
}

# Get Memory usage
get_mem() {
	free --mega | awk 'NR == 2 { print $3" / "$2" MB" }'
}

# Get uptime
get_uptime() {
	uptime -p | sed 's/up//'
}

# Get DE/WM
# Reference: https://github.com/unixporn/robbb/blob/master/fetcher.sh
get_de_wm() {
	wm="${XDG_CURRENT_DESKTOP#*:}"
	[ "$wm" ] || wm="$DESKTOP_SESSION"

	# for most WMs
	[ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && {
		id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
		id=${id##* }
		wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t | grep '^_NET_WM_NAME' | cut -d\" -f 2)
	}

	# for non-EWMH WMs
	[ ! "$wm" ] || [ "$wm" = "LG3D" ] &&
		wm=$(ps -e | grep -m 1 -o \
			-e "sway" \
			-e "kiwmi" \
			-e "wayfire" \
			-e "sowm" \
			-e "catwm" \
			-e "fvwm" \
			-e "dwm" \
			-e "2bwm" \
			-e "monsterwm" \
			-e "tinywm" \
			-e "xmonad")
	
	echo ${wm:-unknown}
}

setup_fonts

echo "               "
echo -e "               ${c1}os${c3}     $(get_distro_name)"
echo -e "               ${c2}krnl${c3}   $(uname -r)"
echo -e "     ${c3}•${c8}_${c3}•${c0}       ${c7}pkgs${c3}   $(get_pkg_count)"
echo -e "     ${c8}${c0}${c9}oo${c0}${c8}|${c0}       ${c4}sh${c3}     ${SHELL##*/}"
echo -e "    ${c8}/${c0}${c10} ${c0}${c8}'\'${c0}      ${c6}ram${c3}    $(get_mem)"
echo -e "   ${c9}(${c0}${c8}\_;/${c0}${c9})${c0}      ${c1}init${c3}   $(get_init)"
echo -e "               ${c2}de/wm${c3}  $(get_de_wm)"
echo -e "               ${c7}up${c3}    $(get_uptime)"
echo -e "               ${c6}disk${c3}   $(get_storage_info)"
echo -e "               "
echo -e "         ${c6}A  ${c6}${c2}R  ${c2}${c4}C  ${c4}${c5}H   ${c5}${c7}B  ${c7}${c4}T  ${c4}${c2}W  ${c2}"
echo -e "               \033[0m"

imma move to void i don't want to lose this

samuelnihbos avatar Feb 28 '22 03:02 samuelnihbos

I edited the mayTermux's config to work on desktops haha

image

https://github.com/WooxHimself/rxfetch-stylish

nwvh avatar May 21 '22 16:05 nwvh

Got rxfetch working on MacOS (mostly) image Unfortunately, the pacman icons will have to wait until I can figure out how to add them in. I also added a somewhat good port of the free command from Linux as a small bash function. I then made $os a global variable to minimise reusing. The only other thing missing is the Apple logo in place of Tux. A small problem is that getting the number of packages from homebrew is quite slow.

Here's the code:

#!/usr/bin/env bash

#colors
#bold="(tput bold)"
magenta="\033[1;35m"
green="\033[1;32m"
white="\033[1;37m"
blue="\033[1;34m"
red="\033[1;31m"
black="\033[1;40;30m"
yellow="\033[1;33m"
cyan="\033[1;36m"
reset="\033[0m"
bgyellow="\033[1;43;33m"
bgwhite="\033[1;47;37m"
c0=${reset}
c1=${magenta}
c2=${green}
c3=${white}
c4=${blue}
c5=${red}
c6=${yellow}
c7=${cyan}
c8=${black}
c9=${bgyellow}
c10=${bgwhite}

os=$(uname -s)

# Setup fonts
setup_fonts() {
	if [ "$os" != Android ]; then
		if ! fc-match :family='Material' | grep -Eq '^Material.ttf'; then
			mkdir -p "$HOME/.local/share/fonts"
			cp ttf-material-design-icons/* "$HOME/.local/share/fonts"
			fc-cache -vf &>/dev/null
		fi
	fi
}

# Get the init
get_init() {
	if [ "$os" = "Android" ]; then
		echo 'init.rc'
	elif [ "$os" = "Darwin" ]; then
		echo 'launchd'
	elif pidof -q systemd; then
		echo 'systemd'
	elif [ -f '/sbin/openrc' ]; then
		echo 'openrc'
	else
		cut -d ' ' -f 1 /proc/1/comm
	fi
}

# Get count of packages installed
get_pkg_count() {
	package_managers=('xbps-install' 'apk' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge')
	for package_manager in "${package_managers[@]}"; do
		if command -v "$package_manager" 2>/dev/null >&2; then
			case "$package_manager" in
			xbps-install) xbps-query -l | wc -l ;;
			apk) apk search | wc -l ;;
			apt) echo $(($(apt list --installed 2>/dev/null | wc -l) - 1)) ;;
			pacman) pacman -Q | wc -l ;;
			nix) nix-env -qa --installed '*' | wc -l ;;
			dnf) dnf list installed | wc -l ;;
			rpm) rpm -qa | wc -l ;;
			emerge) qlist -I | wc -l ;;
			esac

			# if a package manager is found return from the function
			return
		fi
	done
	echo 0
}

# Get count of snaps installed
get_snap_count() {
	if command -v snap 2>/dev/null >&2; then
		count=$(snap list | wc -l)

		# snap list shows a header line
		echo $((count - 1))

		return
	fi

	echo 0
}

# Get count of flatpaks installed
get_flatpak_count() {
	if command -v flatpak 2>/dev/null >&2; then
		flatpak list | wc -l
		return
	fi

	echo 0
}

# Get package information formatted
get_package_info() {
	if [[ $(which -s brew) != "brew not found" ]] ; then
		echo "$(brew list -1 --formulae | wc -l) + $(brew list -1 --cask | wc -l)" | bc
		return
	fi

	pkg_count=$(get_pkg_count)
	snap_count=$(get_snap_count)
	flatpak_count=$(get_flatpak_count)

	if [ "$pkg_count" -ne 0 ]; then
		echo -n "$pkg_count"
		if [ "$snap_count" -ne 0 ]; then
			echo -n " ($snap_count snaps"
			if [ "$flatpak_count" -ne 0 ]; then
				echo ", $flatpak_count flatpaks)"
			else
				echo ")"
			fi
		elif [ "$flatpak_count" -ne 0 ]; then
			echo " ($flatpak_count flatpaks)"
		else
			echo ""
		fi
	elif [ "$snap_count" -ne 0 ]; then
		echo -n "$snap_count snaps"

		if [ "$flatpak_count" -ne 0 ]; then
			echo ", $flatpak_count flatpaks"
		else
			echo ""
		fi
	elif [ "$flatpak_count" -ne 0 ]; then
		echo "$flatpak_count flatpaks"
	else
		echo "Unknown"
	fi
}

# Get distro name
get_distro_name() {
	if [ "$os" = "Android" ]; then
		echo 'Android'
	elif [ "$os" = "Darwin" ]; then
		echo "MacOS" $(sw_vers -productVersion)
	else
		awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release
	fi
}

# Get root partition space used
get_storage_info() {
	if [ "$os" = Android ]; then
		_MOUNTED_ON="/data"
		_GREP_ONE_ROW="$(df -h | grep ${_MOUNTED_ON})"
		_SIZE="$(echo "${_GREP_ONE_ROW}" | awk '{print $2}')"
		_USED="$(echo "${_GREP_ONE_ROW}" | awk '{print $3}')"
		echo "$(head -n1 <<<"${_USED}")B / $(head -n1 <<<"${_SIZE}")B"
	elif [ "$os" = "Darwin" ]; then
		df -h | head -n 2 | tail -n 1 | awk '{ print $3" / "$2 }'
	else
		df -h --output=used,size / | awk 'NR == 2 { print $1" / "$2 }'
	fi
}

free_command_mac() {
	_TOTALMEM=$(echo "$(sysctl hw.memsize | awk '{print $2}') / 1024 / 1024" | bc)
	_FREEMEM=$(echo "$(vm_stat | head -n 1 | awk '{print $8}') * $(vm_stat | head -n 2 | tail -n 1 |  awk '{print $3}' | sed 's/[^0-9]*//g') / 1024 / 1024" | bc)
	_USEDMEM=$(echo "$_TOTALMEM - $_FREEMEM" | bc)
	_TOTALSWAP=$(echo "$(sysctl vm.swapusage | awk '{print $4}' | sed 's/[^0-9\.]*//g') * 1024" | bc)
	_USEDSWAP=$(echo "$(sysctl vm.swapusage | awk '{print $7}' | sed 's/[^0-9\.]*//g') * 1024" | bc)
	_FREESWAP=$(echo "$(sysctl vm.swapusage | awk '{print $10}' | sed 's/[^0-9\.]*//g') * 1024" | bc)
	if [ $(sysctl vm.swapusage | awk '{print $11}') > /dev/null ]; then
		_ENCRYPT=$(sysctl vm.swapusage | awk '{print $11}')
	fi
	printf "   $(printf "XXX: total used free\nMem: $_TOTALMEM $_USEDMEM $_FREEMEM\nNULL\nSwap: $_TOTALSWAP $_USEDSWAP $_FREESWAP $_ENCRYPT\n" | column -t | sed -e '1!b' -e 's/^[^:]*:/ /g')\n"
}

# Get Memory usage
get_mem() {
	if [ "$os" = "Darwin" ]; then
		echo $(free_command_mac | awk 'NR == 2 { print $3" / "$2" MB" }')
	else
		echo $(free --mega | awk 'NR == 2 { print $3" / "$2" MB" }')
	fi
}

# Get uptime
get_uptime() {
	if [ "$os" = "Darwin" ]; then
		uptime | sed 's/.*up//' | sed 's/, load averages: .*//'
	else
		uptime -p | sed 's/up//'
	fi
}

# Get DE/WM
# Reference: https://github.com/unixporn/robbb/blob/master/fetcher.sh
get_de_wm() {
	if [ "$os" = "Darwin" ]; then
		echo "Default"
	else
		wm="${XDG_CURRENT_DESKTOP#*:}"
		[ "$wm" ] || wm="$DESKTOP_SESSION"

		# for most WMs
		[ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && {
			id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null)
			id=${id##* }
			wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t 2>/dev/null | grep '^_NET_WM_NAME' | cut -d\" -f 2)
		}

		# for non-EWMH WMs
		[ ! "$wm" ] || [ "$wm" = "LG3D" ] &&
			wm=$(pgrep -m 1 -o \
				-e "sway" \
				-e "kiwmi" \
				-e "wayfire" \
				-e "sowm" \
				-e "catwm" \
				-e "fvwm" \
				-e "dwm" \
				-e "2bwm" \
				-e "monsterwm" \
				-e "tinywm" \
				-e "xmonad")

		echo "${wm:-unknown}"
	fi
}

setup_fonts

echo "               "

if [ "$os" = Android ]; then
	echo -e "               ${c5}phone${c3}  $(getprop ro.product.brand) $(getprop ro.product.model)"
fi

echo -e "               ${c1}os${c3}     $(get_distro_name) $(uname -m)"
echo -e "               ${c2}ker${c3}    $(uname -r)"
echo -e "     ${c3}•${c8}_${c3}•${c0}       ${c7}pkgs${c3}   $(get_package_info)"
echo -e "     ${c8}${c0}${c9}oo${c0}${c8}|${c0}       ${c4}sh${c3}     ${SHELL##*/}"
echo -e "    ${c8}/${c0}${c10} ${c0}${c8}'\'${c0}      ${c6}ram${c3}    $(get_mem)"
echo -e "   ${c9}(${c0}${c8}\_;/${c0}${c9})${c0}      ${c1}init${c3}   $(get_init)"

if [ -n "$DISPLAY" ]; then
	echo -e "               ${c2}de/wm${c3}  $(get_de_wm)"
fi

echo -e "               ${c7}up${c3}    $(get_uptime)"
echo -e "               ${c6}disk${c3}   $(get_storage_info)"
echo -e "               "

if [ "$os" != Android ]; then
	echo -e "        ${c6}󰮯  ${c6}${c2}󰊠  ${c2}${c4}󰊠  ${c4}${c5}󰊠  ${c5}${c7}󰊠  ${c7}"
fi

echo -e "               \033[0m"

drawblank avatar Jun 01 '22 11:06 drawblank

Nice work 👍 might add it to the official repo after you successfully get those pacman and ghosts working.

Mangeshrex avatar Jun 01 '22 11:06 Mangeshrex

Turns out that Nerd Fonts does not have the Pacman icon at all, and the Material Design Icon fonts are broken on MacOS. So, there's three possible options:

  1. Replace the icons with some other icons
  2. Replace the icons with images and use an image protocol like sixel or iTerm2's image protocol
  3. Wait for Nerd Fonts to update or for a substitute to be released

drawblank avatar Jun 01 '22 12:06 drawblank

Uhmm you can add a request for Pacman icon. ig they're accepting requests.

Mangeshrex avatar Jun 01 '22 13:06 Mangeshrex

You could also just make your own font, if you felt like it.

DakshG07 avatar Jun 27 '22 18:06 DakshG07

I have no idea how to do that? Do you know a way I can do that?

Mangeshrex avatar Jun 28 '22 01:06 Mangeshrex

I have no idea how to do that? Do you know a way I can do that?

Fontforge or other font designers/editor apps

nwvh avatar Jun 28 '22 05:06 nwvh

yo, i make a edit of a edit of a edit lmfao image

justleoo avatar Jul 29 '22 15:07 justleoo

yo, i make a edit of a edit of a edit lmfao image

that looks really cool actually and im on void too, can you link that config :eyes:

ghost avatar Oct 08 '22 21:10 ghost

oh nevermind, i figured out how to do it, it's basically the config nwvh made. sorry for the reply!

ghost avatar Oct 08 '22 21:10 ghost

and unfortunately i came out of the void

Mangeshrex avatar Oct 09 '22 03:10 Mangeshrex

@13-05 https://github.com/mayTermux/rxfetch-termux this is the config

Mangeshrex avatar Oct 09 '22 03:10 Mangeshrex

Replaced package count with the terminal because it took kinda long to load for me: I also added an installation script Code: https://github.com/ignxcy/rxfetch

ignacek1 avatar Jun 17 '23 15:06 ignacek1

Got rxfetch working on MacOS (mostly)

image

Unfortunately, the pacman icons will have to wait until I can figure out how to add them in.

I also added a somewhat good port of the free command from Linux as a small bash function. I then made $os a global variable to minimise reusing.

The only other thing missing is the Apple logo in place of Tux.

A small problem is that getting the number of packages from homebrew is quite slow.

Here's the code:


#!/usr/bin/env bash



#colors

#bold="(tput bold)"

magenta="\033[1;35m"

green="\033[1;32m"

white="\033[1;37m"

blue="\033[1;34m"

red="\033[1;31m"

black="\033[1;40;30m"

yellow="\033[1;33m"

cyan="\033[1;36m"

reset="\033[0m"

bgyellow="\033[1;43;33m"

bgwhite="\033[1;47;37m"

c0=${reset}

c1=${magenta}

c2=${green}

c3=${white}

c4=${blue}

c5=${red}

c6=${yellow}

c7=${cyan}

c8=${black}

c9=${bgyellow}

c10=${bgwhite}



os=$(uname -s)



# Setup fonts

setup_fonts() {

	if [ "$os" != Android ]; then

		if ! fc-match :family='Material' | grep -Eq '^Material.ttf'; then

			mkdir -p "$HOME/.local/share/fonts"

			cp ttf-material-design-icons/* "$HOME/.local/share/fonts"

			fc-cache -vf &>/dev/null

		fi

	fi

}



# Get the init

get_init() {

	if [ "$os" = "Android" ]; then

		echo 'init.rc'

	elif [ "$os" = "Darwin" ]; then

		echo 'launchd'

	elif pidof -q systemd; then

		echo 'systemd'

	elif [ -f '/sbin/openrc' ]; then

		echo 'openrc'

	else

		cut -d ' ' -f 1 /proc/1/comm

	fi

}



# Get count of packages installed

get_pkg_count() {

	package_managers=('xbps-install' 'apk' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge')

	for package_manager in "${package_managers[@]}"; do

		if command -v "$package_manager" 2>/dev/null >&2; then

			case "$package_manager" in

			xbps-install) xbps-query -l | wc -l ;;

			apk) apk search | wc -l ;;

			apt) echo $(($(apt list --installed 2>/dev/null | wc -l) - 1)) ;;

			pacman) pacman -Q | wc -l ;;

			nix) nix-env -qa --installed '*' | wc -l ;;

			dnf) dnf list installed | wc -l ;;

			rpm) rpm -qa | wc -l ;;

			emerge) qlist -I | wc -l ;;

			esac



			# if a package manager is found return from the function

			return

		fi

	done

	echo 0

}



# Get count of snaps installed

get_snap_count() {

	if command -v snap 2>/dev/null >&2; then

		count=$(snap list | wc -l)



		# snap list shows a header line

		echo $((count - 1))



		return

	fi



	echo 0

}



# Get count of flatpaks installed

get_flatpak_count() {

	if command -v flatpak 2>/dev/null >&2; then

		flatpak list | wc -l

		return

	fi



	echo 0

}



# Get package information formatted

get_package_info() {

	if [[ $(which -s brew) != "brew not found" ]] ; then

		echo "$(brew list -1 --formulae | wc -l) + $(brew list -1 --cask | wc -l)" | bc

		return

	fi



	pkg_count=$(get_pkg_count)

	snap_count=$(get_snap_count)

	flatpak_count=$(get_flatpak_count)



	if [ "$pkg_count" -ne 0 ]; then

		echo -n "$pkg_count"

		if [ "$snap_count" -ne 0 ]; then

			echo -n " ($snap_count snaps"

			if [ "$flatpak_count" -ne 0 ]; then

				echo ", $flatpak_count flatpaks)"

			else

				echo ")"

			fi

		elif [ "$flatpak_count" -ne 0 ]; then

			echo " ($flatpak_count flatpaks)"

		else

			echo ""

		fi

	elif [ "$snap_count" -ne 0 ]; then

		echo -n "$snap_count snaps"



		if [ "$flatpak_count" -ne 0 ]; then

			echo ", $flatpak_count flatpaks"

		else

			echo ""

		fi

	elif [ "$flatpak_count" -ne 0 ]; then

		echo "$flatpak_count flatpaks"

	else

		echo "Unknown"

	fi

}



# Get distro name

get_distro_name() {

	if [ "$os" = "Android" ]; then

		echo 'Android'

	elif [ "$os" = "Darwin" ]; then

		echo "MacOS" $(sw_vers -productVersion)

	else

		awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release

	fi

}



# Get root partition space used

get_storage_info() {

	if [ "$os" = Android ]; then

		_MOUNTED_ON="/data"

		_GREP_ONE_ROW="$(df -h | grep ${_MOUNTED_ON})"

		_SIZE="$(echo "${_GREP_ONE_ROW}" | awk '{print $2}')"

		_USED="$(echo "${_GREP_ONE_ROW}" | awk '{print $3}')"

		echo "$(head -n1 <<<"${_USED}")B / $(head -n1 <<<"${_SIZE}")B"

	elif [ "$os" = "Darwin" ]; then

		df -h | head -n 2 | tail -n 1 | awk '{ print $3" / "$2 }'

	else

		df -h --output=used,size / | awk 'NR == 2 { print $1" / "$2 }'

	fi

}



free_command_mac() {

	_TOTALMEM=$(echo "$(sysctl hw.memsize | awk '{print $2}') / 1024 / 1024" | bc)

	_FREEMEM=$(echo "$(vm_stat | head -n 1 | awk '{print $8}') * $(vm_stat | head -n 2 | tail -n 1 |  awk '{print $3}' | sed 's/[^0-9]*//g') / 1024 / 1024" | bc)

	_USEDMEM=$(echo "$_TOTALMEM - $_FREEMEM" | bc)

	_TOTALSWAP=$(echo "$(sysctl vm.swapusage | awk '{print $4}' | sed 's/[^0-9\.]*//g') * 1024" | bc)

	_USEDSWAP=$(echo "$(sysctl vm.swapusage | awk '{print $7}' | sed 's/[^0-9\.]*//g') * 1024" | bc)

	_FREESWAP=$(echo "$(sysctl vm.swapusage | awk '{print $10}' | sed 's/[^0-9\.]*//g') * 1024" | bc)

	if [ $(sysctl vm.swapusage | awk '{print $11}') > /dev/null ]; then

		_ENCRYPT=$(sysctl vm.swapusage | awk '{print $11}')

	fi

	printf "   $(printf "XXX: total used free\nMem: $_TOTALMEM $_USEDMEM $_FREEMEM\nNULL\nSwap: $_TOTALSWAP $_USEDSWAP $_FREESWAP $_ENCRYPT\n" | column -t | sed -e '1!b' -e 's/^[^:]*:/ /g')\n"

}



# Get Memory usage

get_mem() {

	if [ "$os" = "Darwin" ]; then

		echo $(free_command_mac | awk 'NR == 2 { print $3" / "$2" MB" }')

	else

		echo $(free --mega | awk 'NR == 2 { print $3" / "$2" MB" }')

	fi

}



# Get uptime

get_uptime() {

	if [ "$os" = "Darwin" ]; then

		uptime | sed 's/.*up//' | sed 's/, load averages: .*//'

	else

		uptime -p | sed 's/up//'

	fi

}



# Get DE/WM

# Reference: https://github.com/unixporn/robbb/blob/master/fetcher.sh

get_de_wm() {

	if [ "$os" = "Darwin" ]; then

		echo "Default"

	else

		wm="${XDG_CURRENT_DESKTOP#*:}"

		[ "$wm" ] || wm="$DESKTOP_SESSION"



		# for most WMs

		[ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && {

			id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null)

			id=${id##* }

			wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t 2>/dev/null | grep '^_NET_WM_NAME' | cut -d\" -f 2)

		}



		# for non-EWMH WMs

		[ ! "$wm" ] || [ "$wm" = "LG3D" ] &&

			wm=$(pgrep -m 1 -o \

				-e "sway" \

				-e "kiwmi" \

				-e "wayfire" \

				-e "sowm" \

				-e "catwm" \

				-e "fvwm" \

				-e "dwm" \

				-e "2bwm" \

				-e "monsterwm" \

				-e "tinywm" \

				-e "xmonad")



		echo "${wm:-unknown}"

	fi

}



setup_fonts



echo "               "



if [ "$os" = Android ]; then

	echo -e "               ${c5}phone${c3}  $(getprop ro.product.brand) $(getprop ro.product.model)"

fi



echo -e "               ${c1}os${c3}     $(get_distro_name) $(uname -m)"

echo -e "               ${c2}ker${c3}    $(uname -r)"

echo -e "     ${c3}•${c8}_${c3}•${c0}       ${c7}pkgs${c3}   $(get_package_info)"

echo -e "     ${c8}${c0}${c9}oo${c0}${c8}|${c0}       ${c4}sh${c3}     ${SHELL##*/}"

echo -e "    ${c8}/${c0}${c10} ${c0}${c8}'\'${c0}      ${c6}ram${c3}    $(get_mem)"

echo -e "   ${c9}(${c0}${c8}\_;/${c0}${c9})${c0}      ${c1}init${c3}   $(get_init)"



if [ -n "$DISPLAY" ]; then

	echo -e "               ${c2}de/wm${c3}  $(get_de_wm)"

fi



echo -e "               ${c7}up${c3}    $(get_uptime)"

echo -e "               ${c6}disk${c3}   $(get_storage_info)"

echo -e "               "



if [ "$os" != Android ]; then

	echo -e "        ${c6}󰮯  ${c6}${c2}󰊠  ${c2}${c4}󰊠  ${c4}${c5}󰊠  ${c5}${c7}󰊠  ${c7}"

fi



echo -e "               \033[0m"

Good work. You said that brew packages take a long time? I don't see a brew query in the script. Could be because of that.

0n1cOn3 avatar Dec 18 '23 06:12 0n1cOn3

@0n1cOn3 https://github.com/Mangeshrex/rxfetch/blob/0a8b2c6dd01f221b66a25a1ae6bed3249d7c4e3d/rxfetch#L116

It's not the commented one but my variant

proffapt avatar Dec 18 '23 11:12 proffapt

@0n1cOn3

https://github.com/Mangeshrex/rxfetch/blob/0a8b2c6dd01f221b66a25a1ae6bed3249d7c4e3d/rxfetch#L116

It's not the commented one but my variant

When adding this into an PR 👍🏻 :D

0n1cOn3 avatar Dec 18 '23 13:12 0n1cOn3

@0n1cOn3 https://github.com/Mangeshrex/rxfetch/blob/0a8b2c6dd01f221b66a25a1ae6bed3249d7c4e3d/rxfetch#L116

It's not the commented one but my variant

When adding this into an PR 👍🏻 :D

This already exists in the main branch XD

proffapt avatar Dec 19 '23 09:12 proffapt

@0n1cOn3

https://github.com/Mangeshrex/rxfetch/blob/0a8b2c6dd01f221b66a25a1ae6bed3249d7c4e3d/rxfetch#L116

It's not the commented one but my variant

When adding this into an PR 👍🏻 :D

This already exists in the main branch XD

I should probably read more often the source code 🙄😂 whoopsi 🤣

0n1cOn3 avatar Dec 19 '23 11:12 0n1cOn3