RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    updated retropie_welcome() function

    Scheduled Pinned Locked Moved Ideas and Development
    command linecliretropiewelcom
    16 Posts 7 Posters 1.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mituM
      mitu Global Moderator @BuZz
      last edited by

      @blaxthos +1 for including the RetroPie version. But the colors mosaic is a bit distracting.

      H 1 Reply Last reply Reply Quote 1
      • H
        hhromic @mitu
        last edited by

        @blaxthos also would be useful to include the current git commit alongside the RP version, users won't have any excuse to not properly report their exact version here in the forums when asked :)
        also agree with @mitu that maybe is too much coloring :)

        herb_fargusH 1 Reply Last reply Reply Quote 0
        • B
          blaxthos
          last edited by

          Thanks for the replies. Notes below:

          • Some lines were collapsed due to space considerations :)
          • CPU and GPU temps can diverge, but usually only by a few degrees
          • Most colors change on condition (temp, load), to easily add a visual dimension to concerning values
          • Colors can be removed from the code as you like :)
          • Can you give me the CLI command that outputs current git commit? I'll be happy to integrate it.

          Thanks again,
          /b

          H 1 Reply Last reply Reply Quote 0
          • herb_fargusH
            herb_fargus administrators @hhromic
            last edited by

            @hhromic said in updated retropie_welcome() function:

            users won't have any excuse to not properly report their exact version here in the forums when asked :)

            It works in theory except that it only reflects the version of the script installed, not necessarily the version of retropie installed. Eg they can update their setup script but not actually updated anything in their system

            If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

            Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

            B H 2 Replies Last reply Reply Quote 0
            • B
              blaxthos @herb_fargus
              last edited by

              @herb_fargus , is there a better way that will reflect the actual live version?

              1 Reply Last reply Reply Quote 0
              • H
                hhromic @blaxthos
                last edited by

                @blaxthos said in updated retropie_welcome() function:

                Thanks for the replies. Notes below:

                • Some lines were collapsed due to space considerations :)
                • CPU and GPU temps can diverge, but usually only by a few degrees
                • Most colors change on condition (temp, load), to easily add a visual dimension to concerning values

                I actually like coloring the values based on a concept such as "good" or "bad.

                What I find a bit distracting is so many colors on the other elements. For example, the CPU speed is dark blue and the others are cyan. Same for IP-address, that is yellow.

                In my humble opinion, all values should use the same base color (for example cyan), except these that depend on "good" (green), "warn" (yellow), "bad" (red) semantics such as temperature, system load and disk usage.

                • Colors can be removed from the code as you like :)
                • Can you give me the CLI command that outputs current git commit? I'll be happy to integrate it.

                Yes, sure, it's very simple using git:

                git -C $HOME/RetroPie-Setup log -1 --pretty=format:%h
                

                Thanks again,
                /b

                Thanks for the contribution!

                1 Reply Last reply Reply Quote 0
                • H
                  hhromic @herb_fargus
                  last edited by

                  @herb_fargus said in updated retropie_welcome() function:

                  @hhromic said in updated retropie_welcome() function:

                  users won't have any excuse to not properly report their exact version here in the forums when asked :)

                  It works in theory except that it only reflects the version of the script installed, not necessarily the version of retropie installed. Eg they can update their setup script but not actually updated anything in their system

                  Yes, that's very true, however there is also no simple way to qualify the version of all the installed components in the system individually.
                  I understand that the "version" asked in the forum rules only ask for the RP script installed, no?

                  herb_fargusH 1 Reply Last reply Reply Quote 0
                  • herb_fargusH
                    herb_fargus administrators @hhromic
                    last edited by

                    @hhromic said in updated retropie_welcome() function:

                    I understand that the "version" asked in the forum rules only ask for the RP script installed, no?

                    Technically but in reality it's more the inage they've installed. The biggest issue is just with people using old unsupported images and then wondering why things don't work. It's a better guage than nothing anyways

                    If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                    Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                    1 Reply Last reply Reply Quote 0
                    • D
                      detron
                      last edited by

                      @blaxthos

                      I love the concept of expanding information that is easy to access.

                      one thing I would find useful is to identify the locality settings. I HATE when I go to do a linux command with a keyboard on the pi (not SSH) and I try to pipe something and I do not get a "|" but some other character.

                      another thing that most people would not like, but I would is the hostname. I know most people do not change it, but I change the host name on some.

                      is there any good uses for this to be dumped to a text file as well?

                      1 Reply Last reply Reply Quote 1
                      • B
                        blaxthos
                        last edited by blaxthos

                        Updates and sample output below, based on feedback:

                        updated screenshot

                        replace in .bashrc :

                        function retropie_welcome() {
                        
                            local rst="$(tput sgr0)"
                            local fgblk="${rst}$(tput setaf 0)" # Black - Regular
                            local fgred="${rst}$(tput setaf 1)" # Red
                            local fggrn="${rst}$(tput setaf 2)" # Green
                            local fgylw="${rst}$(tput setaf 3)" # Yellow
                            local fgblu="${rst}$(tput setaf 4)" # Blue
                            local fgpur="${rst}$(tput setaf 5)" # Purple
                            local fgcyn="${rst}$(tput setaf 6)" # Cyan
                            local fgwht="${rst}$(tput setaf 7)" # White
                        
                            local bld="$(tput bold)"
                            local bfgblk="${bld}$(tput setaf 0)"
                            local bfgred="${bld}$(tput setaf 1)"
                            local bfggrn="${bld}$(tput setaf 2)"
                            local bfgylw="${bld}$(tput setaf 3)"
                            local bfgblu="${bld}$(tput setaf 4)"
                            local bfgpur="${bld}$(tput setaf 5)"
                            local bfgcyn="${bld}$(tput setaf 6)"
                            local bfgwht="${bld}$(tput setaf 7)"
                        
                            local upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
                            local secs=$((upSeconds%60))
                            local mins=$((upSeconds/60%60))
                            local hours=$((upSeconds/3600%24))
                            local days=$((upSeconds/86400))
                            local UPTIME=$(printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs")
                        
                            # calculate rough CPU and GPU temperatures:
                            local cpuTempC
                            local cpuTempF
                            local gpuTempC
                            local gpuTempF
                            local cpuColor
                            local gpuColor
                        
                            if [[ -f "/sys/class/thermal/thermal_zone0/temp" ]]; then
                                cpuTempC=$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000)) && cpuTempF=$((cpuTempC*9/5+32))
                            fi
                        
                            if [ "$cpuTempC" -ge 70 ]; then
                                cpuColor=${bfgred}
                            elif [ "$cpuTempC" -ge 65 ]; then
                                cpuColor=${bfgylw}
                            elif [ "$cpuTempC" -gt 55 ]; then
                                cpuColor=${fgylw}
                            elif [ "$cpuTempC" -gt 30 ]; then
                                cpuColor=${fggrn}
                            else
                                cpuColor=${bfggrn}
                            fi
                        
                        
                            if [[ -f "/opt/vc/bin/vcgencmd" ]]; then
                                if gpuTempC=$(/opt/vc/bin/vcgencmd measure_temp); then
                                    gpuTempC=${gpuTempC:5:2}
                                    gpuTempF=$((gpuTempC*9/5+32))
                                else
                                    gpuTempC=""
                                fi
                        
                            fi
                        
                            if [ "$gpuTempC" -ge 70 ]; then
                                gpuColor=${bfgred}
                            elif [ "$gpuTempC" -ge 65 ]; then
                                gpuColor=${bfgylw}
                            elif [ "$gpuTempC" -gt 55 ]; then
                                gpuColor=${fgylw}
                            else
                                gpuColor=${fggrn}
                            fi
                        
                            # do interface cpu and load average things
                            local defaultInterface=$(netstat -nr |grep 0.0.0.0|head -n 1|awk '{print $8}')
                            local cpuSpeed=$(expr $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) / 1000)
                            local loadAvg=($(uptime | awk -F'[a-z]:' '{ print $2}'|sed s/,//g))
                            local loadColor=()
                            local x
                            for x in "${!loadAvg[@]}"; do
                              local myLevel=$(echo ${loadAvg[$x]}|awk -F. '{print $1}')
                              if [ "$myLevel" -eq 0  ]; then
                                loadColor[$x]=${fggrn}
                              elif [ "$myLevel" -eq 1 ]; then
                                loadColor[$x]=${fgylw}
                              elif [ "$myLevel" -eq 2 ]; then
                                loadColor[$x]=${bfgylw}
                              else
                                loadColor[$x]=${bfgred}
                              fi
                            done
                            
                            local df_out=()
                            local line
                            while read line; do
                                df_out+=("$line")
                            done < <(df -h /)
                            local logo=(
                                "${fgred}   .***.   "
                                "${fgred}   ***${bfgwht}*${fgred}*   "
                                "${fgred}   \`***'   "
                                "${bfgwht}    |*|    "
                                "${bfgwht}    |*|    "
                                "${bfgred}  ..${bfgwht}|*|${bfgred}..  "
                                "${bfgred}.*** ${bfgwht}*${bfgred} ***."
                                "${bfgred}*******${fggrn}@@${bfgred}**"
                                "${fgred}\`*${bfgred}****${bfgylw}@@${bfgred}*${fgred}*'"
                                "${fgred} \`*******'${fgrst} "
                                "${fgred}   \`\"\"\"'${fgrst}   "
                                )
                        
                            local out
                            local i
                            for i in "${!logo[@]}"; do
                                out+="  ${logo[$i]}  "
                                case "$i" in
                                    1)
                                        out+="${fggrn}$(date +"%A, %e %B %Y, %r")"
                                        ;;
                                    0)
                                        out+="${fgpur}Retropie v$(cat /opt/retropie/VERSION)${fgred}.${fgpur}$(git -C $HOME/RetroPie-Setup log -1 --pretty=format:%h)${fgred} (${fgblu}$(uname -srmo)${fgred})"
                                        ;;
                                    3)
                                        out+="${fgred}${df_out[0]}"
                                        ;;
                                    4)
                                        out+="${fgcyn}${df_out[1]}"
                                        ;;
                                    5)
                                        out+="${fgred}CPU Speed..........: ${fgcyn}${cpuSpeed}mHz ${fgred}(up ${fgcyn}${UPTIME}${fgred})"
                                        ;;
                                    7)
                                        out+="${fgred}Memory.............: ${fgcyn}$(grep MemFree /proc/meminfo | awk {'print $2'})kB${fgred} (Free) / ${fgcyn}$(grep MemTotal /proc/meminfo | awk {'print $2'})kB${fgred} (Total)"
                                        ;;
                                    6)
                                        out+="${fgred}System 5/10/15 Load: ${loadColor[0]}${loadAvg[0]}${fgred}/${loadColor[1]}${loadAvg[1]}${fgred}/${loadColor[2]}${loadAvg[2]} ${fgred} (${fgcyn}$(ps ax | wc -l | tr -d " ") processes${fgred})"
                                        ;;
                                    8)
                                        out+="${fgred}IP Address.........: ${fgcyn}$(ip route get 8.8.8.8 2>/dev/null | awk '{print $NF; exit}') ${fgred}(${fgblu}${defaultInterface}${fgred})"
                                        ;;
                                    9)
                                        out+="Temperature........: CPU: ${cpuColor}$cpuTempC°C${fgred}/${cpuColor}$cpuTempF°F${fgred} GPU: ${gpuColor}$gpuTempC°C${fgred}/${gpuColor}$gpuTempF°F${fgred}"
                                        ;;
                                    10)
                                        out+="${fgwht}The RetroPie Project, https://retropie.org.uk"
                                        ;;
                                esac
                                out+="\n"
                            done
                            echo -e "\n$out"
                        }
                        
                        1 Reply Last reply Reply Quote 1
                        • Z
                          ziggurat
                          last edited by

                          What about using neofetch?

                          Ask nicely and I am sure he will add asciiart for retropie.
                          Neofetch is configurable by settings, so you cna add the information you like.
                          And i will try to compensate for super narrow monitors too, by cutting off informaton instead of going to the next line.
                          Its in the raspbian repos too.

                          mituM 1 Reply Last reply Reply Quote 0
                          • mituM
                            mitu Global Moderator @ziggurat
                            last edited by

                            @ziggurat I got carried away by looking at neofetch and got this

                            b17c8604-9f05-4eec-b669-034d12abba2a-image.png

                            It's a bit large though for a 64x80 standard Linux console.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.