From 6b9abdb9d6c0a0d82cc625eb296a6ae61af267e7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 14 Aug 2016 13:26:30 +1000 Subject: [PATCH] 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"