diff --git a/neofetch b/neofetch index 48b96d215..0704c9acb 100755 --- a/neofetch +++ b/neofetch @@ -945,6 +945,7 @@ get_os() { AIX) os=AIX ;; IRIX*) os=IRIX ;; FreeMiNT) os=FreeMiNT ;; + Interix) os=Interix ;; Linux|GNU*) os=Linux @@ -1210,6 +1211,10 @@ get_distro() { FreeMiNT) distro=FreeMiNT ;; + + Interix) + distro="Interix ${kernel_version}" + ;; esac distro=${distro//Enterprise Server} @@ -1356,6 +1361,12 @@ get_model() { model=$(sysctl -n hw.model) model=${model/ (_MCH *)} ;; + + Interix) + model="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe computersystem get manufacturer,model)" + model="${model/Manufacturer}" + model="${model/Model}" + ;; esac # Remove dummy OEM info. @@ -1408,6 +1419,13 @@ get_kernel() { return } + # In Interix the Kernel version is commonly comprised of the host OS build number, + # OS architecture and Interix build number + [[ $os == Interix ]] && { + kernel="$(uname -r) $(uname -m) $(uname -v)" + return + } + case $kernel_shorthand in on) kernel=$kernel_version ;; off) kernel="$kernel_name $kernel_version" ;; @@ -1462,6 +1480,19 @@ get_uptime() { s=$((${d:-0}*86400 + ${h:-0}*3600 + ${t%%:*}*60 + ${t#*:})) ;; + Interix) + t="$(LC_ALL=POSIX ps -o etime= -p 0)" + t="${t%%.*}" + + [[ $t == *-* ]] && { d=${t%%-*}; t=${t#*-}; } + [[ $t == *:*:* ]] && { h=${t%%:*}; t=${t#*:}; } + + h="${h#0}" + t="${t#0}" + + s="$((${d:-0}*86400 + ${h:-0}*3600 + ${t%%:*}*60 + ${t#*:}))" + ;; + Haiku) s=$(($(system_time) / 1000000)) ;; @@ -1544,7 +1575,7 @@ get_packages() { } case $os in - Linux|BSD|"iPhone OS"|Solaris) + Linux|BSD|"iPhone OS"|Solaris|Interix) # Package Manager Programs. has kiss && tot kiss l has cpt-list && tot cpt-list @@ -2431,6 +2462,17 @@ get_cpu() { cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)" speed="$(awk -F '[:.M]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" ;; + + "Interix") + cpu="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe cpu get Name)" + cpu="${cpu/Name}" + + speed="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe cpu get CurrentClockSpeed)" + speed="${speed/CurrentClockSpeed}" + + cores="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe cpu get NumberOfCores)" + cores="${cores/NumberOfCores}" + ;; esac # Remove un-needed patterns from cpu output. @@ -2645,6 +2687,22 @@ get_gpu() { done ;; + "Interix") + /dev/fs/C/Windows/System32/wbem/WMIC.exe path Win32_VideoController get caption | while read -r line; do + line=$(trim "$line") + + case $line in + *Caption*|'') + continue + ;; + + *) + prin "${subtitle:+${subtitle}${gpu_name}}" "$line" + ;; + esac + done + ;; + "Haiku") gpu="$(listdev | grep -A2 -F 'device Display controller' |\ awk -F':' '/device beef/ {print $2}')" @@ -2797,6 +2855,20 @@ get_memory() { mem_used="$((mem_used / 1024))" ;; + "Interix") + mem_total="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe computersystem get TotalPhysicalMemory)" + mem_total="${mem_total//[[:space:]]}" + mem_total="${mem_total/TotalPhysicalMemory}" + mem_total="$((mem_total / 1024 / 1024))" + + mem_free="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe os get FreePhysicalMemory)" + mem_free="${mem_free//[[:space:]]}" + mem_free="${mem_free/FreePhysicalMemory}" + mem_free="$((mem_free / 1024))" + + mem_used="$((mem_total - mem_free))" + ;; + esac [[ "$memory_percent" == "on" ]] && ((mem_perc=mem_used * 100 / mem_total)) @@ -3831,6 +3903,15 @@ get_battery() { [[ "$state" == *TRUE* ]] && battery_state="charging" ;; + "Interix") + battery="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe Path Win32_Battery get EstimatedChargeRemaining)" + battery="${battery/EstimatedChargeRemaining}" + battery="$(trim "$battery")%" + state="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe /NameSpace:'\\root\WMI' Path BatteryStatus get Charging)" + state="${state/Charging}" + [[ "$state" == *TRUE* ]] && battery_state="charging" + ;; + "Haiku") battery0full="$(awk -F '[^0-9]*' 'NR==2 {print $4}' /dev/power/acpi_battery/0)" battery0now="$(awk -F '[^0-9]*' 'NR==5 {print $4}' /dev/power/acpi_battery/0)" @@ -3891,7 +3972,7 @@ get_local_ip() { fi ;; - "Windows") + "Windows" | "Interix") local_ip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2 ", "}')" local_ip="${local_ip%\,*}" ;; @@ -7982,6 +8063,29 @@ ${c1} | EOF ;; + "Interix"*) + set_colors 1 7 4 0 3 + read -rd '' ascii_data <<'EOF' +${c1} .${c3}. +${c1} 75${c3}G! +${c1} ^?PG${c3}&&J. +${c1} :!5GPP${c3}&&&B! +${c1} :YPPPPP${c3}&&&&&Y: +${c1} !5PPPPPP${c3}&&&&&&B! +${c1} :?PPPPPPPP${c3}&&&&&&&&Y~ +${c1} !5PPPPPPPPP${c3}###&&&&&&B7 +${c1} :?PPPP5555555${c3}B####&&&&&&5: +${c1} ~5PPPP555YJ${c5}7!~7?${c3}5B###&&&&&B?. +${c1} .:JPPPP5555Y${c5}?^....:^?${c3}G####&&&&&5: +${c1} 75PPP555555Y${c5}7:....:^!${c3}5#####&&&&&B7. +${c1} :JPPPP${c2}555555YY?${c5}~::::^~${c2}7YPGBB###${c3}&&&&&5^ +${c1}75${c2}GGPPPPPP555555YJ?77??YYYYYY55PPGGB#${c3}&B? +${c2}~!!7JY5PGGBBBBBBBBGGGGGGGBGGGGGP5YJ?7~~~ + .::^~7?JYPGBB#BGPYJ?7!7^:. + ..:^... +EOF + ;; + "januslinux"*|"janus"*|"Ataraxia Linux"*|"Ataraxia"*) set_colors 4 5 6 2 read -rd '' ascii_data <<'EOF'