From 6b9abdb9d6c0a0d82cc625eb296a6ae61af267e7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 14 Aug 2016 13:26:30 +1000 Subject: [PATCH 1/9] Add new model function to print device model name --- config/config | 1 + neofetch | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/config/config b/config/config index 2425557e..0a632165 100644 --- a/config/config +++ b/config/config @@ -18,6 +18,7 @@ printinfo () { info title info underline + info "Model" model info "OS" distro info "Kernel" kernel info "Uptime" uptime diff --git a/neofetch b/neofetch index 9d6a0d22..5d6eacd2 100755 --- a/neofetch +++ b/neofetch @@ -36,6 +36,57 @@ getos() { # }}} +# Model {{{ + +getmodel() { + case "$os" in + "Linux") + model="$(< /sys/devices/virtual/dmi/id/product_version)" + model="${model/To Be Filled*}" + ;; + + "iPhone OS") + case "${ios_model:-$(uname -m)}" in + "iPad1,1") model="iPad" ;; + "iPad2,"[1-4]) model="iPad2" ;; + "iPad3,"[1-3]) model="iPad3" ;; + "iPad3,"[4-6]) model="iPad4" ;; + "iPad4,"[1-3]) model="iPad Air" ;; + "iPad5,"[3-4]) model="iPad Air 2" ;; + "iPad6,"[7-8]) model="iPad Pro (12.9 Inch)" ;; + "iPad6,"[3-4]) model="iPad Pro (9.7 Inch)" ;; + "iPad2,"[5-7]) model="iPad mini" ;; + "iPad4,"[4-6]) model="iPad mini 2" ;; + "iPad4,"[7-9]) model="iPad mini 3" ;; + "iPad5,"[1-2]) model="iPad mini 4" ;; + + "iPhone1,1") model="iPhone" ;; + "iPhone1,2") model="iPhone 3G" ;; + "iPhone2,1") model="iPhone 3GS" ;; + "iPhone3,"[1-3]) model="iPhone 4" ;; + "iPhone4,1") model="iPhone 4S" ;; + "iPhone5,"[1-2]) model="iPhone 4" ;; + "iPhone5,"[3-4]) model="iPhone 5c" ;; + "iPhone6,"[1-2]) model="iPhone 5s" ;; + "iPhone7,2") model="iPhone 6" ;; + "iPhone7,1") model="iPhone 6 Plus" ;; + "iPhone8,1") model="iPhone 6s" ;; + "iPhone8,2") model="iPhone 6s Plus" ;; + "iPhone8,4") model="iPhone SE" ;; + + "iPod1,1") model="iPod touch" ;; + "ipod2,1") model="iPod touch 2G" ;; + "ipod3,1") model="iPod touch 3G" ;; + "ipod4,1") model="iPod touch 4G" ;; + "ipod5,1") model="iPod touch 5G" ;; + "ipod7,1") model="iPod touch 6G" ;; + esac + ;; + esac +} + +# }}} + # Distro {{{ getdistro() { @@ -587,8 +638,7 @@ getcpu() { ;; "iPhone OS") - ios_model="${ios_model:-$(uname -m)}" - case "$ios_model" in + case "${ios_model:-$(uname -m)}" in "iPhone1,1" | "iPhone1,2" | "iPod1,1") cpu="Samsung S5L8900 @ 412MHz" cores="1" From 8d2db93545dd314c4abe54d7730facd1393d07fa Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sun, 14 Aug 2016 14:01:31 +1000 Subject: [PATCH 2/9] added macOS support for model name --- neofetch | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neofetch b/neofetch index 5d6eacd2..6577b9ec 100755 --- a/neofetch +++ b/neofetch @@ -82,6 +82,11 @@ getmodel() { "ipod7,1") model="iPod touch 6G" ;; esac ;; + + "Mac OS X") + model="$(sysctl hw.model)" + model="${model//hw.model: /}" + ;; esac } From 53d2cf6661332c29b58cf5b8ff47f7873fd361dc Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sun, 14 Aug 2016 14:09:28 +1000 Subject: [PATCH 3/9] made PR two lines shorter :) --- neofetch | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 6577b9ec..879031c2 100755 --- a/neofetch +++ b/neofetch @@ -83,10 +83,7 @@ getmodel() { esac ;; - "Mac OS X") - model="$(sysctl hw.model)" - model="${model//hw.model: /}" - ;; + "Mac OS X") model="$(sysctl -n hw.model)" ;; esac } From f8056231710bd49c119396227ed590f6eaf59132 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 14 Aug 2016 14:16:25 +1000 Subject: [PATCH 4/9] Add model to travis test mode --- neofetch | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 879031c2..50de9ae7 100755 --- a/neofetch +++ b/neofetch @@ -45,6 +45,7 @@ getmodel() { model="${model/To Be Filled*}" ;; + "Mac OS X") model="$(sysctl -n hw.model)" ;; "iPhone OS") case "${ios_model:-$(uname -m)}" in "iPad1,1") model="iPad" ;; @@ -82,8 +83,6 @@ getmodel() { "ipod7,1") model="iPod touch 6G" ;; esac ;; - - "Mac OS X") model="$(sysctl -n hw.model)" ;; esac } @@ -3018,7 +3017,7 @@ getargs() { esac ;; --test) - info=(title underline distro kernel uptime packages shell resolution de wm wmtheme theme icons cpu cpu_usage gpu memory font disk battery song localip publicip users birthday term termfont) + info=(title underline model distro kernel uptime packages shell resolution de wm wmtheme theme icons cpu cpu_usage gpu memory font disk battery song localip publicip users birthday term termfont) refresh_rate="on" shell_version="on" From 3461b2a02947c6cd74f40e5debfbf2bdf978fdcc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 14 Aug 2016 15:23:19 +1000 Subject: [PATCH 5/9] Model: Added Windows support --- neofetch | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neofetch b/neofetch index 50de9ae7..dd560270 100755 --- a/neofetch +++ b/neofetch @@ -83,6 +83,12 @@ getmodel() { "ipod7,1") model="iPod touch 6G" ;; esac ;; + + "Windows") + model="$(wmic computersystem get manufacturer,model /value)" + model="${model/Manufacturer'='}" + model="${model/Model'='}" + ;; esac } From 346bff1c5229ccdf78eb70c9d809f9fb6db81524 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 14 Aug 2016 17:41:09 +0700 Subject: [PATCH 6/9] Added Solaris support for model --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index dd560270..458d97cc 100755 --- a/neofetch +++ b/neofetch @@ -89,6 +89,10 @@ getmodel() { model="${model/Manufacturer'='}" model="${model/Model'='}" ;; + + "Solaris") + model="$(prtconf -b | awk -F':' '/banner-name/ {printf $2}')" + ;; esac } From a96420e067969aad22a2502b83ddbc0540f9f06b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 19 Aug 2016 10:39:12 +1000 Subject: [PATCH 7/9] Model: Add BSD support --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index dd560270..398a0735 100755 --- a/neofetch +++ b/neofetch @@ -84,6 +84,10 @@ getmodel() { esac ;; + "BSD") + model="$(sysctl -n hw.vendor hw.product 2>/dev/null)" + ;; + "Windows") model="$(wmic computersystem get manufacturer,model /value)" model="${model/Manufacturer'='}" From 4b4b0437d97194b38a073f03788e27f99b8e3aca Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 19 Aug 2016 11:15:13 +1000 Subject: [PATCH 8/9] Also include product name --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index dad9d742..685383f2 100755 --- a/neofetch +++ b/neofetch @@ -41,7 +41,7 @@ getos() { getmodel() { case "$os" in "Linux") - model="$(< /sys/devices/virtual/dmi/id/product_version)" + model="$(< /sys/devices/virtual/dmi/id/product_{name,version} 2>/dev/null)" model="${model/To Be Filled*}" ;; From 065b0d21a0c85f0c93efaae27952530463692638 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 19 Aug 2016 11:25:17 +1000 Subject: [PATCH 9/9] Model (Linux): Use cat to fix issues --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 685383f2..df78463e 100755 --- a/neofetch +++ b/neofetch @@ -41,7 +41,7 @@ getos() { getmodel() { case "$os" in "Linux") - model="$(< /sys/devices/virtual/dmi/id/product_{name,version} 2>/dev/null)" + model="$(cat /sys/devices/virtual/dmi/id/product_{name,version} 2>/dev/null)" model="${model/To Be Filled*}" ;;