OS: Added support for Windows (MSYS2)
This commit is contained in:
parent
b674bc7ace
commit
c4dc3ab3a8
49
neofetch
49
neofetch
|
@ -34,7 +34,7 @@ get_os() {
|
||||||
"Linux" | "GNU"*) os="Linux" ;;
|
"Linux" | "GNU"*) os="Linux" ;;
|
||||||
"Darwin") os="$(sw_vers -productName)" ;;
|
"Darwin") os="$(sw_vers -productName)" ;;
|
||||||
*"BSD" | "DragonFly" | "Bitrig") os="BSD" ;;
|
*"BSD" | "DragonFly" | "Bitrig") os="BSD" ;;
|
||||||
"CYGWIN"*) os="Windows" ;;
|
"CYGWIN"* | "MSYS"*) os="Windows" ;;
|
||||||
"SunOS") os="Solaris" ;;
|
"SunOS") os="Solaris" ;;
|
||||||
"Haiku") os="Haiku" ;;
|
"Haiku") os="Haiku" ;;
|
||||||
"MINIX") os="MINIX" ;;
|
"MINIX") os="MINIX" ;;
|
||||||
|
@ -169,10 +169,10 @@ get_distro() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
distro="$(wmic os get Caption /value)"
|
distro="$(wmic os get Caption)"
|
||||||
|
|
||||||
# Strip crap from the output of wmic.
|
# Strip crap from the output of wmic.
|
||||||
distro="${distro/Caption'='}"
|
distro="${distro/Caption}"
|
||||||
distro="${distro/Microsoft }"
|
distro="${distro/Microsoft }"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -264,9 +264,9 @@ get_model() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
model="$(wmic computersystem get manufacturer,model /value)"
|
model="$(wmic computersystem get manufacturer,model)"
|
||||||
model="${model/Manufacturer'='}"
|
model="${model/Manufacturer}"
|
||||||
model="${model/Model'='}"
|
model="${model/Model}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Solaris")
|
"Solaris")
|
||||||
|
@ -474,7 +474,10 @@ get_packages() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
packages="$(cygcheck -cd | wc -l)"
|
case "$kernel_name" in
|
||||||
|
"CYGWIN"*) packages="$(cygcheck -cd | wc -l)" ;;
|
||||||
|
"MSYS"*) packages="$(pacman -Qq --color never | wc -l)"
|
||||||
|
esac
|
||||||
|
|
||||||
# Count chocolatey packages.
|
# Count chocolatey packages.
|
||||||
[[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \
|
[[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \
|
||||||
|
@ -957,8 +960,8 @@ get_cpu() {
|
||||||
get_cpu_usage() {
|
get_cpu_usage() {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Windows")
|
"Windows")
|
||||||
cpu_usage="$(wmic cpu get loadpercentage /value)"
|
cpu_usage="$(wmic cpu get loadpercentage)"
|
||||||
cpu_usage="${cpu_usage/LoadPercentage'='}"
|
cpu_usage="${cpu_usage/LoadPercentage}"
|
||||||
cpu_usage="${cpu_usage//[[:space:]]}"
|
cpu_usage="${cpu_usage//[[:space:]]}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1105,8 +1108,8 @@ get_gpu() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
gpu="$(wmic path Win32_VideoController get caption /value)"
|
gpu="$(wmic path Win32_VideoController get caption)"
|
||||||
gpu="${gpu//Caption'='}"
|
gpu="${gpu//Caption}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Haiku")
|
"Haiku")
|
||||||
|
@ -1325,11 +1328,11 @@ get_resolution() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
width="$(wmic path Win32_VideoController get CurrentHorizontalResolution /value)"
|
width="$(wmic path Win32_VideoController get CurrentHorizontalResolution)"
|
||||||
width="${width//CurrentHorizontalResolution'='/}"
|
width="${width//CurrentHorizontalResolution/}"
|
||||||
|
|
||||||
height="$(wmic path Win32_VideoController get CurrentVerticalResolution /value)"
|
height="$(wmic path Win32_VideoController get CurrentVerticalResolution)"
|
||||||
height="${height//CurrentVerticalResolution'='/}"
|
height="${height//CurrentVerticalResolution/}"
|
||||||
|
|
||||||
[[ "$(trim "$width")" ]] && resolution="${width}x${height}"
|
[[ "$(trim "$width")" ]] && resolution="${width}x${height}"
|
||||||
;;
|
;;
|
||||||
|
@ -1697,8 +1700,8 @@ get_battery() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining /value)"
|
battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining)"
|
||||||
battery="${battery/EstimatedChargeRemaining'='}"
|
battery="${battery/EstimatedChargeRemaining}"
|
||||||
[[ "$(trim "$battery")" ]] && battery="%"
|
[[ "$(trim "$battery")" ]] && battery="%"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1771,7 +1774,12 @@ get_install_date() {
|
||||||
"Linux" | "iPhone OS") install_file="/lost+found" ;;
|
"Linux" | "iPhone OS") install_file="/lost+found" ;;
|
||||||
"Mac OS X") install_file="/var/log/install.log" ;;
|
"Mac OS X") install_file="/var/log/install.log" ;;
|
||||||
"Solaris") install_file="/var/sadm/system/logs/install_log" ;;
|
"Solaris") install_file="/var/sadm/system/logs/install_log" ;;
|
||||||
"Windows") install_file="/cygdrive/c/Windows/explorer.exe" ;;
|
"Windows")
|
||||||
|
case "$kernel_name" in
|
||||||
|
"CYGWIN"*) install_file="/cygdrive/c/Windows/explorer.exe" ;;
|
||||||
|
"MSYS"*) install_file="/c/Windows/explorer.exe" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
"Haiku") install_file="/boot" ;;
|
"Haiku") install_file="/boot" ;;
|
||||||
"BSD" | "MINIX")
|
"BSD" | "MINIX")
|
||||||
case "$kernel_name" in
|
case "$kernel_name" in
|
||||||
|
@ -2039,7 +2047,10 @@ get_wallpaper() {
|
||||||
"Windows")
|
"Windows")
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
"Windows XP")
|
"Windows XP")
|
||||||
image="/cygdrive/c/Documents and Settings/${USER}"
|
case "$kernel_name" in
|
||||||
|
"CYGWIN"*) image="/cygdrive/c/Documents and Settings/${USER}" ;;
|
||||||
|
"MSYS2"*) image="/c/Documents and Settings/${USER}" ;;
|
||||||
|
esac
|
||||||
image+="/Local Settings/Application Data/Microsoft"
|
image+="/Local Settings/Application Data/Microsoft"
|
||||||
image+="/Wallpaper1.bmp"
|
image+="/Wallpaper1.bmp"
|
||||||
;;
|
;;
|
||||||
|
|
Reference in New Issue