From 69c219e351db5f3cf78447409cdaddd46fc7f845 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 1 Jan 2018 12:20:07 -0500 Subject: [PATCH] Formatting fixes and awk improvements for FreeMiNT. Changed method for finding DE and WM processes in FreeMiNT. --- ascii/distro/gem | 34 +++++++++++------------- neofetch | 69 ++++++++++++++++++++---------------------------- 2 files changed, 43 insertions(+), 60 deletions(-) diff --git a/ascii/distro/gem b/ascii/distro/gem index d69ae938..49c8849d 100644 --- a/ascii/distro/gem +++ b/ascii/distro/gem @@ -1,19 +1,15 @@ - - - ${c1} ## - ## ######### - #### ## - #### #### ## - #### #### ## ## - #### #### ## ## - #### #### ## ## ## - #### ###### - ###### ## ## #### - #### ################ - #### ## #### - ## #### ###### - ## ## #### #### - ## ## ## ## ## #### - #### ## ## ## - - +${c1} ## + ## ######### + #### ## + #### #### ## +#### #### ## ## + #### #### ## ## + #### #### ## ## ## + #### ###### + ###### ## ## #### + #### ################ + #### ## #### + ## #### ###### + ## ## #### #### + ## ## ## ## ## #### + #### ## ## ## diff --git a/neofetch b/neofetch index 4d629770..d01c63dd 100755 --- a/neofetch +++ b/neofetch @@ -441,7 +441,6 @@ get_uptime() { now="$(date +%s)" seconds="$((now - boot))" ;; - esac days="$((seconds / 60 / 60 / 24)) days" @@ -625,7 +624,6 @@ get_packages() { type -p rpm >/dev/null && \ packages="$((packages+=$(rpm -qa | wc -l)))" ;; - esac ((packages == 0)) && unset packages @@ -678,21 +676,16 @@ get_de() { "FreeMiNT") get_wm - if [ -e /proc/thing* ]; then - de="Thing" - elif [ -e /proc/jinnee* ]; then - de="Jinnee" - elif [ -e /proc/tera* ]; then - de="Teradesk" - elif [ -e /proc/mdesk ]; then - de="mDesk" - elif [ -e /proc/neod* ]; then - de="NeoDesk" - elif [ -e /proc/zdesk* ]; then - de="zDesk" - else - de="Atari" - fi + for possibles in "$(ls /proc)"; do + case "$possibles" in + *thing*) de="Thing" ;; + *jinnee*) de="Jinnee" ;; + *tera*) de="Teradesk" ;; + *neod*) de="NeoDesk" ;; + *zdesk*) de="zDesk" ;; + *mdesk*) de="mDesk" ;; + esac + done ;; *) @@ -807,19 +800,16 @@ get_wm() { ;; "FreeMiNT") - if [ -e /proc/xaaes* ]; then - wm="XaAES" - elif [ -e /proc/myaes* ]; then - wm="MyAES" - elif [ -e /proc/naes* ]; then - wm="N.AES" - elif [ -e /proc/geneva* ]; then - wm="Geneva" - else - wm="Atari AES" - fi + wm="Atari AES" + for possibles in "$(ls /proc | awk -F'[ .]' '/aes|geneva/ {print $1}')"; do + case "$possibles" in + *xaaes*) wm="XaAES" ;; + *myaes*) wm="MyAES" ;; + *naes*) wm="N.AES" ;; + geneva) wm="Geneva" ;; + esac + done ;; - esac fi @@ -1163,10 +1153,9 @@ get_cpu() { ;; "FreeMiNT") - cpu="$(cat /kern/cpuinfo | awk -F':' '/CPU:/ {printf $2}')" - speed="$(cat /kern/cpuinfo | awk -F':' '/Clocking:/ {printf $2}' | awk -F'.' '{ printf $1 }')" + cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)" + speed="$(awk -F'[:.]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" ;; - esac # Remove un-needed patterns from cpu output. @@ -1511,11 +1500,11 @@ get_memory() { ;; "FreeMiNT") - mem_total="$(cat /kern/meminfo | awk -F ':|kB' '/MemTotal:/ {printf $2}')" - mem_free="$(cat /kern/meminfo | awk -F ':|kB' '/MemFree:/ {printf $2}')" - mem_used="$(( mem_total - mem_free ))" - mem_total="$(( mem_total / 1024 ))" - mem_used="$(( mem_used / 1024 ))" + mem_total="$(awk -F ':|kB' '/MemTotal:/ {printf $2}' /kern/meminfo)" + mem_free="$(awk -F ':|kB' '/MemFree:/ {printf $2}' /kern/meminfo)" + mem_used="$((mem_total - mem_free))" + mem_total="$((mem_total / 1024))" + mem_used="$((mem_used / 1024))" ;; esac @@ -1907,9 +1896,8 @@ get_term() { esac # Most likely TosWin2 on FreeMiNT - quick check - if [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]]; then + [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && \ term="TosWin2" - fi # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do @@ -2464,9 +2452,8 @@ get_cols() { # TosWin2 on FreeMiNT is terrible at this, # so we'll reset colors arbitrarily - if [ "${term}" == "TosWin2" ]; then + [[ "$term" == "TosWin2" ]] && \ printf "%b\n" "\\e[30;47m" - fi # Tell info() that we printed manually. prin=1