- support Msys2 - show exact release version on Windows 10 - use modern logo on Windows 8, 10 and their server equivalents --- a/screenfetch-dev +++ b/screenfetch-dev @@ -190,7 +190,7 @@ } supported_distros="Antergos, Arch Linux (Old and Current Logos), BLAG, CentOS, Chakra, Chapeau, CrunchBang, CRUX, Debian, Deepin, Dragora, elementary OS, Evolve OS, Fedora, Frugalware, Fuduntu, Funtoo, Gentoo, gNewSense, Jiyuu Linux, Kali Linux, KaOS, Korora, LinuxDeepin, Linux Mint, LMDE, Logos, Mageia, Mandriva/Mandrake, Manjaro, NixOS, openSUSE, Parabola GNU/Linux-libre, PeppermintOS, Raspbian, Red Hat Enterprise Linux, Sabayon, Scientific Linux, Slackware, Solus, TinyCore, Trisquel, Ubuntu, Viperr and Void." -supported_other="Dragonfly/Free/Open/Net BSD, Haiku, Mac OS X and Windows+Cygwin." +supported_other="Dragonfly/Free/Open/Net BSD, Haiku, Mac OS X, Windows+Cygwin and Windows+Msys." supported_dms="KDE, Gnome, Unity, Xfce, LXDE, Cinnamon, MATE, CDE and RazorQt." supported_wms="2bwm, 9wm, Awesome, Beryl, Blackbox, Cinnamon, Compiz, dminiwm, dwm, dtwm, E16, E17, echinus, Emerald, FluxBox, FVWM, herbstluftwm, IceWM, KWin, Metacity, monsterwm, Musca, Gala, Mutter, Muffin, Notion, OpenBox, PekWM, Ratpoison, Sawfish, ScrotWM, SpectrWM, StumpWM, subtle, WindowMaker, WMFS, wmii, Xfwm4, XMonad and i3." @@ -519,6 +519,11 @@ distro="Cygwin" fake_distro="${distro}" ;; + "Msys") + distro="Msys" + fake_distro="${distro}" + distro_more="$(uname -r | head -c 1)" + ;; "Haiku") distro="Haiku" fake_distro="${distro}" @@ -535,6 +539,12 @@ ;; esac fi + if [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + # https://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx + if [ "$(wmic os get version | grep -o '^\(6\.[23]\|10\)')" ]; then + fake_distro="Windows - Modern" + fi + fi if [[ "${distro}" == "Unknown" ]]; then if [ -f /etc/os-release ]; then distrib_id=$(/dev/null 2>&1; then if [[ "$distro" =~ "BSD" ]]; then @@ -1227,7 +1239,7 @@ if [[ "$(echo $xResolution | wc -l)" -ge 1 ]]; then xResolution=$(echo $xResolution | tr "\\n" "," | sed 's/\(.*\),/\1/') fi - elif [[ "${distro}" == "Cygwin" ]]; then + elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then width=($(wmic desktopmonitor get screenwidth | grep -vE '[a-z]+' | tr '\r\n' ' ')) height=($(wmic desktopmonitor get screenheight | grep -vE '[a-z]+' | tr '\r\n' ' ')) @@ -1250,7 +1262,7 @@ # DE Detection - Begin detectde () { DE="Not Present" - if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" ]]; then + if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" && "${distro}" != "Msys" ]]; then if [[ -n ${DISPLAY} ]]; then if type -p xprop >/dev/null 2>&1;then xprop_root="$(xprop -root 2>/dev/null)" @@ -1474,11 +1486,13 @@ if ps -U ${USER} | grep [F]inder >/dev/null 2>&1; then DE="Aqua" fi - elif [[ "${distro}" == "Cygwin" ]]; then - winver=`wmic os get version | grep -o '^[0-9]'` - if [ "$winver" == "7" ]; then DE='Aero' - elif [ "$winver" == "6" ]; then DE='Aero' - else DE='Luna'; fi + elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + # https://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx + if [ "$(wmic os get version | grep -o '^\(6\|10\)')" ]; then + DE='Aero' + else + DE='Luna' + fi fi verboseOut "Finding desktop environment...found as '$DE'" } @@ -1488,7 +1502,7 @@ # WM Detection - Begin detectwm () { WM="Not Found" - if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" ]]; then + if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" && "${distro}" != "Msys" ]]; then if [[ -n ${DISPLAY} ]]; then for each in "${wmnames[@]}"; do PID="$(pgrep -U ${UID} "^$each$")" @@ -1617,7 +1631,7 @@ if ps -U ${USER} | grep Finder >/dev/null 2>&1; then WM="Quartz Compositor" fi - elif [[ "${distro}" == "Cygwin" ]]; then + elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then bugn=$(tasklist | grep -o 'bugn' | tr -d '\r \n') wind=$(tasklist | grep -o 'Windawesome' | tr -d '\r \n') if [ "$bugn" = "bugn" ]; then WM="bug.n" @@ -1753,8 +1767,8 @@ else Win_theme="Graphite" fi - elif [[ "${distro}" == "Cygwin" ]]; then - themeFile="$(reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Themes' /v 'CurrentTheme' | grep -o '[A-Z]:\\.*')" + elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + themeFile="$(reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Themes' //v 'CurrentTheme' | grep -o '[A-Z]:\\.*')" Win_theme=$(echo $themeFile | awk -F"\\" '{print $NF}' | grep -o '[0-9A-z. ]*$' | grep -o '^[0-9A-z ]*') fi @@ -1995,8 +2009,8 @@ fi fi - if [ "$distro" == "Cygwin" -a "$gtkFont" == "Not Found" ]; then - if [ -f "$HOME/.minttyrc" ]; then + if [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + if [[ "$gtkFont" == "Not Found" && -f "$HOME/.minttyrc" ]]; then gtkFont="$(grep '^Font=.*' "$HOME/.minttyrc" | grep -o '[0-9A-z ]*$')" fi fi @@ -2131,9 +2145,9 @@ asciiText () { # Distro logos and ASCII outputs - if [[ "$fake_distro" ]]; then distro="${fake_distro}"; fi if [[ "$asc_distro" ]]; then myascii="${asc_distro}" elif [[ "$art" ]]; then myascii="custom" + elif [[ "$fake_distro" ]]; then myascii="${fake_distro}" else myascii="${distro}"; fi case ${myascii} in "custom") source "$art" ;; @@ -3207,7 +3221,7 @@ "${c3} o' %s\n") ;; - "Windows"|"Cygwin") + "Windows"|"Cygwin"|"Msys") if [[ "$no_color" != "1" ]]; then c1=$(getColor 'light red') # Red c2=$(getColor 'light green') # Green @@ -3234,6 +3248,33 @@ "${c4} \"VEzjt:;;z>*\` %s") ;; + "Windows - Modern") + if [[ "$no_color" != "1" ]]; then + c1=$(getColor 'light blue') # Blue + fi + if [ -n "${my_lcolor}" ]; then c1="${my_lcolor}"; fi + startline="0" + fulloutput=("${c1} .., %s" +"${c1} ....,,:;+ccllll %s" +"${c1} ...,,+:; cllllllllllllllllll %s" +"${c1} ,cclllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} llllllllllllll lllllllllllllllllll %s" +"${c1} \`'ccllllllllll lllllllllllllllllll %s" +"${c1} \`'\"\"*:: :ccllllllllllllllll %s" +"${c1} \`\`\`\`''\"*::cll %s" +"${c1} \`\` %s") + ;; + "Haiku") if [[ "$no_color" != "1" ]]; then c1=$(getColor 'black_haiku') # Black @@ -3906,7 +3947,7 @@ "Arch Linux - Old"|"Fedora"|"Korora"|"Chapeau"|"Mandriva"|"Mandrake"|"Chakra"|"ChromeOS"|"Sabayon"|"Slackware"|"Mac OS X"|"Trisquel"|"Kali Linux"|"Jiyuu Linux"|"Antergos"|"KaOS"|"Logos"|"gNewSense"|"NixOS") labelcolor=$(getColor 'light blue');; "Arch Linux"|"Frugalware"|"Mageia"|"Deepin"|"CRUX") labelcolor=$(getColor 'light cyan');; "Mint"|"LMDE"|"openSUSE"|"LinuxDeepin"|"DragonflyBSD"|"Manjaro"|"Manjaro-tree"|"Android"|"Void") labelcolor=$(getColor 'light green');; - "Ubuntu"|"FreeBSD"|"FreeBSD - Old"|"Debian"|"Raspbian"|"BSD"|"Red Hat Enterprise Linux"|"Peppermint"|"Cygwin"|"Fuduntu"|"NetBSD"|"Scientific Linux"|"DragonFlyBSD"|"BackTrack Linux") labelcolor=$(getColor 'light red');; + "Ubuntu"|"FreeBSD"|"FreeBSD - Old"|"Debian"|"Raspbian"|"BSD"|"Red Hat Enterprise Linux"|"Peppermint"|"Cygwin"|"Msys"|"Fuduntu"|"NetBSD"|"Scientific Linux"|"DragonFlyBSD"|"BackTrack Linux") labelcolor=$(getColor 'light red');; "CrunchBang"|"Solus"|"Viperr"|"elementary"*) labelcolor=$(getColor 'dark grey');; "Gentoo"|"Parabola GNU/Linux-libre"|"Funtoo"|"Funtoo-text"|"BLAG") labelcolor=$(getColor 'light purple');; "Haiku") labelcolor=$(getColor 'green');; @@ -3941,10 +3982,12 @@ buildVers=`buildVers=$(sw_vers|grep BuildVersion);echo ${buildVers:14}` if [ -n "$distro_more" ]; then mydistro=$(echo -e "$labelcolor OS:$textcolor $distro_more $sysArch") else mydistro=$(echo -e "$labelcolor OS:$textcolor $sysArch $distro $prodVers $buildVers"); fi - elif [[ "$distro" == "Cygwin" ]]; then - distro=$(wmic os get name | head -2 | tail -1) - distro=$(expr match "$distro" '\(Microsoft Windows [A-Za-z0-9.]\+\)') - sysArch=$(wmic os get OSArchitecture | head -2 | tail -1 | tr -d '\r ') + elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + distro="$(wmic os get caption | sed 's/\r//g; s/[ \t]*$//g; 2!d')" + if [[ "$(wmic os get version | grep -o '^10\.')" == "10." ]]; then + distro="$distro (v$(wmic os get version | grep '^10\.' | tr -d ' '))" + fi + sysArch=$(wmic os get OSArchitecture | sed 's/\r//g; s/[ \t]*$//g; 2!d') mydistro=$(echo -e "$labelcolor OS:$textcolor $distro $sysArch") else if [ -n "$distro_more" ]; then mydistro=$(echo -e "$labelcolor OS:$textcolor $distro_more") @@ -4018,7 +4061,7 @@ # [ "$gtkBackground" ] && mybg=$(echo -e "$labelcolor BG:$textcolor $gtkBackground"); out_array=( "${out_array[@]}" "$mybg" ); ((display_index++)) fi fi - elif [[ "$fake_distro" == "Cygwin" ]]; then + elif [[ "${fake_distro}" == "Cygwin" || "${fake_distro}" == "Msys" || "${fake_distro}" == "Windows - Modern" ]]; then if [[ "${display[@]}" =~ "res" && -n "$xResolution" ]]; then myres=$(echo -e "$labelcolor Resolution:${textcolor} $xResolution"); out_array=( "${out_array[@]}" "$myres" ); ((display_index++)); fi if [[ "${display[@]}" =~ "de" ]]; then if [[ "${DE}" != "Not Present" ]]; then @@ -4034,7 +4077,7 @@ fi fi fi - [[ "${fake_distro}" != "Cygwin" ]] && if [[ "${display[@]}" =~ "disk" ]]; then mydisk=$(echo -e "$labelcolor Disk:$textcolor $diskusage"); out_array=( "${out_array[@]}" "$mydisk" ); ((display_index++)); fi + [[ "${fake_distro}" != "Cygwin" && "${fake_distro}" != "Msys" && "${fake_distro}" != "Windows - Modern" ]] && if [[ "${display[@]}" =~ "disk" ]]; then mydisk=$(echo -e "$labelcolor Disk:$textcolor $diskusage"); out_array=( "${out_array[@]}" "$mydisk" ); ((display_index++)); fi if [[ "${display[@]}" =~ "cpu" ]]; then mycpu=$(echo -e "$labelcolor CPU:$textcolor $cpu"); out_array=( "${out_array[@]}" "$mycpu" ); ((display_index++)); fi if [[ "${display[@]}" =~ "gpu" ]] && [[ "$gpu" != "Not Found" ]]; then mygpu=$(echo -e "$labelcolor GPU:$textcolor $gpu"); out_array=( "${out_array[@]}" "$mygpu" ); ((display_index++)); fi if [[ "${display[@]}" =~ "mem" ]]; then mymem=$(echo -e "$labelcolor RAM:$textcolor $mem"); out_array=( "${out_array[@]}" "$mymem" ); ((display_index++)); fi