diff options
| author | Joe <rrbo@proton.me> | 2023-02-03 11:43:42 +0100 | 
|---|---|---|
| committer | Joe <rrbo@proton.me> | 2023-02-03 11:43:42 +0100 | 
| commit | 69b19d1863c0e822df092bd78d21045bd4d0a7be (patch) | |
| tree | 4debdc2d86af646664ce6bed53a4f562bb257949 | |
| parent | up (diff) | |
| download | dotfiles-bsd-69b19d1863c0e822df092bd78d21045bd4d0a7be.tar.gz dotfiles-bsd-69b19d1863c0e822df092bd78d21045bd4d0a7be.tar.bz2 dotfiles-bsd-69b19d1863c0e822df092bd78d21045bd4d0a7be.tar.xz dotfiles-bsd-69b19d1863c0e822df092bd78d21045bd4d0a7be.tar.zst dotfiles-bsd-69b19d1863c0e822df092bd78d21045bd4d0a7be.zip | |
up
Diffstat (limited to '')
| -rwxr-xr-x | .local/bin/conky/net.sh | 48 | 
1 files changed, 39 insertions, 9 deletions
| diff --git a/.local/bin/conky/net.sh b/.local/bin/conky/net.sh index 4316e1a..7a95f70 100755 --- a/.local/bin/conky/net.sh +++ b/.local/bin/conky/net.sh @@ -1,20 +1,50 @@  #!/bin/sh  os="$(uname)" +tmpfile="/tmp/os" -if [ "$os" = "Linux" ]; then -	grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 -elif [ "$os" = "FreeBSD" ]; then -	os=3 +if ! [ -e "/tmp/os" ]; then +	if [ "$os" = "Linux" ]; then +		grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 +	elif [ "$os" = "FreeBSD" ]; then +		os=3 +	else +		echo "unknown OS" +		exit 1 +	fi +	echo $os >$tmpfile  else -	echo "unknown OS" -	exit 1 +	$os=$(cat $tmpfile)  fi  case $os in -	1) icon=" " ;; -	2) icon=" " ;; -	3) icon=" " ;; +	1) +		if_main="eth1" +		if_alt="eth0" +		if grep up "/sys/class/net/$if_main/operstate" >/dev/null 2>&1; then +			: +		elif grep up "/sys/class/net/$if_alt/operstate" >/dev/null 2>&1; then +			if_main=$if_alt +		else +			exit +		fi +		;; +	2) +		if_main="enx4ce1734c425a" +		if_alt="wlp1s0" +		if grep up "/sys/class/net/$if_main/operstate" >/dev/null 2>&1; then +			: +		elif grep up "/sys/class/net/$if_alt/operstate" >/dev/null 2>&1; then +			if_main=$if_alt +		else +			exit +		fi +		;; +	3) +		if_main="em0" +		if_alt="wlan0" +		exit +		;;  esac  echo '${color grey}Net' | 
