From ffb2e0afbfe066244c4a8e57d932fe45775d7121 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 09:55:10 +1100 Subject: [PATCH 01/12] Added xoffset --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index b2f05971..fa5f8017 100755 --- a/neofetch +++ b/neofetch @@ -2747,6 +2747,7 @@ if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then ;; "iterm2") + printf "\033[${xoffset}C" printf "%b%s\a\n" "\033]1337;File=width=${image_size}px;height=${image_size}px;inline=1:$(base64 < "$img")" ;; esac From f954552bafcd5fb59b9a7c37339508a4c7b69e30 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 10:51:30 +1100 Subject: [PATCH 02/12] xoffset now pushes text over too --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index fa5f8017..e8cc2aed 100755 --- a/neofetch +++ b/neofetch @@ -1942,7 +1942,7 @@ getimage () { case "$image_position" in "left") # Padding is half the terminal width + gap - padding="\033[$((image_size / font_width + gap))C" + padding="\033[$((image_size / font_width + gap + xoffset/font_width))C" ;; "right") From 31ea9fd6f403ff312359b23bd94ad7aa52389a02 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 10:59:22 +1100 Subject: [PATCH 03/12] iterm2 xoffset take a pixel value instead of terminal cells --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index e8cc2aed..c56eaaf5 100755 --- a/neofetch +++ b/neofetch @@ -2747,7 +2747,7 @@ if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then ;; "iterm2") - printf "\033[${xoffset}C" + printf "\033[$((xoffset / font_width))C" printf "%b%s\a\n" "\033]1337;File=width=${image_size}px;height=${image_size}px;inline=1:$(base64 < "$img")" ;; esac From b60f73efb381e1499c34cf0707798f982d9d7adf Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 22:49:37 +1100 Subject: [PATCH 04/12] Add ability to set osx_codename --- neofetch | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index c56eaaf5..667c3e0d 100755 --- a/neofetch +++ b/neofetch @@ -464,8 +464,23 @@ case "$os" in ;; "Mac OS X") - distro="Mac OS X $(sw_vers -productVersion)" - [ "$osx_buildversion" == "on" ] && distro+=" $(sw_vers -buildVersion)" + osx_version=$(sw_vers -productVersion) + osx_version="10.11.3" + + case "$osx_version" in + "10.4."*) osx_codename="Mac OS X Tiger" ;; + "10.5."*) osx_codename="Mac OS X Leopard" ;; + "10.6."*) osx_codename="Mac OS X Snow Leopard" ;; + "10.7."*) osx_codename="Mac OS X Lion" ;; + "10.8."*) osx_codename="OS X Mountain Lion" ;; + "10.9."*) osx_codename="OS X Mavericks" ;; + "10.10."*) osx_codename="OS X Yosemite" ;; + "10.11."*) osx_codename="OS X El Capitan" ;; + *) distro="Mac OS X $osx_version" ;; + esac + distro="$osx_codename $osx_version" + + [ "$osx_buildversion" == "on" ] && distro+="$(sw_vers -buildVersion)" ;; "OpenBSD") @@ -2209,8 +2224,9 @@ colors () { setcolors 4 8 ;; - "Mac"* | "Manjaro"* | "Deepin"*) + *"OS X"* ) setcolors 2 3 1 1 5 4 + ascii_distro="mac" ;; "OpenMandriva"*) @@ -2242,7 +2258,7 @@ colors () { setcolors 3 3 6 1 8 ;; - "OpenSuse"*) + "OpenSuse"* | "Manjaro"* | "Deepin"*) setcolors 2 7 ;; @@ -2595,6 +2611,11 @@ while [ "$1" ]; do esac done ;; + --osx_codename) + case "$2" in + "off") distro=${distro/${osx_codename}/Mac OS X} ;; + esac + ;; # Text Colors --colors) @@ -2780,6 +2801,5 @@ if [ "$scrot" == "on" ]; then takescrot fi - # }}} From 24d1b76fac5ee95a7cf9de2eb5d652ad23ac44fc Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 22:50:52 +1100 Subject: [PATCH 05/12] Remove stray line from other branch --- neofetch | 1 - 1 file changed, 1 deletion(-) diff --git a/neofetch b/neofetch index 667c3e0d..d1a69faf 100755 --- a/neofetch +++ b/neofetch @@ -2768,7 +2768,6 @@ if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then ;; "iterm2") - printf "\033[$((xoffset / font_width))C" printf "%b%s\a\n" "\033]1337;File=width=${image_size}px;height=${image_size}px;inline=1:$(base64 < "$img")" ;; esac From 7783aaa8c5e9411cc5d94d82ea5b3508c3a12b84 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 22:51:33 +1100 Subject: [PATCH 06/12] Remove stray line from other branch --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d1a69faf..fc4a7bd2 100755 --- a/neofetch +++ b/neofetch @@ -1957,7 +1957,7 @@ getimage () { case "$image_position" in "left") # Padding is half the terminal width + gap - padding="\033[$((image_size / font_width + gap + xoffset/font_width))C" + padding="\033[$((image_size / font_width + gap))C" ;; "right") From 3ead0bf5c5cb8373b358fa1ddf857ce1dc48befa Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 22:53:33 +1100 Subject: [PATCH 07/12] Removed hardcoded string from testing --- neofetch | 1 - 1 file changed, 1 deletion(-) diff --git a/neofetch b/neofetch index fc4a7bd2..79bedbc6 100755 --- a/neofetch +++ b/neofetch @@ -465,7 +465,6 @@ case "$os" in "Mac OS X") osx_version=$(sw_vers -productVersion) - osx_version="10.11.3" case "$osx_version" in "10.4."*) osx_codename="Mac OS X Tiger" ;; From c400e44c2f412db2cdc401ecf74801930da08500 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 22:54:51 +1100 Subject: [PATCH 08/12] Fix double whitespace when build version is enabled --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 79bedbc6..a0b44180 100755 --- a/neofetch +++ b/neofetch @@ -479,7 +479,7 @@ case "$os" in esac distro="$osx_codename $osx_version" - [ "$osx_buildversion" == "on" ] && distro+="$(sw_vers -buildVersion)" + [ "$osx_buildversion" == "on" ] && distro+=" $(sw_vers -buildVersion)" ;; "OpenBSD") From 64d90f8a4a39f8dc3505b82987ab6fefba58e8c6 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 23:08:08 +1100 Subject: [PATCH 09/12] Add config option and fix bugs with codename output --- config/config | 4 ++++ neofetch | 40 +++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/config/config b/config/config index 0a261c8b..31d671cf 100644 --- a/config/config +++ b/config/config @@ -62,6 +62,10 @@ kernel_shorthand="on" # --osx_buildversion on/off osx_buildversion="on" +# Mac OS X hide/show codename +# --osx_codename on/off +osx_codename="on" + # Show 'x86_64' and 'x86' in 'Distro:' output. # --os_arch on/off os_arch="on" diff --git a/neofetch b/neofetch index a0b44180..e569b026 100755 --- a/neofetch +++ b/neofetch @@ -84,6 +84,10 @@ kernel_shorthand="on" # --osx_buildversion on/off osx_buildversion="on" +# Mac OS X hide/show codename +# --osx_codename on/off +osx_codename="on" + # Show 'x86_64' and 'x86' in 'Distro:' output. # --os_arch on/off os_arch="on" @@ -467,17 +471,17 @@ case "$os" in osx_version=$(sw_vers -productVersion) case "$osx_version" in - "10.4."*) osx_codename="Mac OS X Tiger" ;; - "10.5."*) osx_codename="Mac OS X Leopard" ;; - "10.6."*) osx_codename="Mac OS X Snow Leopard" ;; - "10.7."*) osx_codename="Mac OS X Lion" ;; - "10.8."*) osx_codename="OS X Mountain Lion" ;; - "10.9."*) osx_codename="OS X Mavericks" ;; - "10.10."*) osx_codename="OS X Yosemite" ;; - "10.11."*) osx_codename="OS X El Capitan" ;; - *) distro="Mac OS X $osx_version" ;; + "10.4."*) codename="Mac OS X Tiger" ;; + "10.5."*) codename="Mac OS X Leopard" ;; + "10.6."*) codename="Mac OS X Snow Leopard" ;; + "10.7."*) codename="Mac OS X Lion" ;; + "10.8."*) codename="OS X Mountain Lion" ;; + "10.9."*) codename="OS X Mavericks" ;; + "10.10."*) codename="OS X Yosemite" ;; + "10.11."*) codename="OS X El Capitan" ;; + *) codename="Mac OS X" ;; esac - distro="$osx_codename $osx_version" + distro="$codename $osx_version" [ "$osx_buildversion" == "on" ] && distro+=" $(sw_vers -buildVersion)" ;; @@ -2584,6 +2588,7 @@ while [ "$1" ]; do # Info --os_arch) os_arch="$2" ;; --osx_buildversion) osx_buildversion="$2" ;; + --osx_codename) osx_codename="$2" ;; --speed_type) speed_type="$2" ;; --kernel_shorthand) kernel_shorthand="$2" ;; --uptime_shorthand) uptime_shorthand="$2" ;; @@ -2610,11 +2615,6 @@ while [ "$1" ]; do esac done ;; - --osx_codename) - case "$2" in - "off") distro=${distro/${osx_codename}/Mac OS X} ;; - esac - ;; # Text Colors --colors) @@ -2729,6 +2729,16 @@ done # }}} +# OS overides {{{ + +# Overide OS X codename +case "$osx_codename" in + "off") distro=${distro/${codename}/Mac OS X} ;; +esac + +# }}} + + # Call Functions and Finish Up {{{ From 28f936e03fd5cae228fd31b866cb51e0b41a755f Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 23:12:58 +1100 Subject: [PATCH 10/12] Update docs --- README.md | 1 + neofetch | 1 + neofetch.1 | 3 +++ 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 686f4b78..6857f8de 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,7 @@ alias fetch2="fetch \ NOTE: You can supply multiple args. eg. 'fetch --disable cpu gpu disk shell' --osx_buildversion on/off Hide/Show Mac OS X build version. + --osx_codename on/off Hide/Show Mac OS X codename. --os_arch on/off Hide/Show Windows architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, diff --git a/neofetch b/neofetch index e569b026..956c3e14 100755 --- a/neofetch +++ b/neofetch @@ -2467,6 +2467,7 @@ usage () { cat << EOF NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu disk shell' --osx_buildversion on/off Hide/Show Mac OS X build version. + --osx_codename on/off Hide/Show Mac OS X codename. --os_arch on/off Hide/Show Windows architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, diff --git a/neofetch.1 b/neofetch.1 index 99449f7c..af8716fc 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -22,6 +22,9 @@ NOTE: You can supply multiple args. eg. .B \--osx_buildversion 'on/off' Hide/Show Mac OS X build version. .TP +.B \--osx_codename 'on/off' +Hide/Show Mac OS X codename. +.TP .B \--os_arch 'on/off' Hide/Show Windows architecture. .TP From 9d40beb18614eeb7a6f2173b078a37f70063aafd Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 23:23:10 +1100 Subject: [PATCH 11/12] Drop the .XX from OSX version --- neofetch | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index 956c3e14..df5d971d 100755 --- a/neofetch +++ b/neofetch @@ -469,16 +469,17 @@ case "$os" in "Mac OS X") osx_version=$(sw_vers -productVersion) + osx_version=${osx_version%.*} case "$osx_version" in - "10.4."*) codename="Mac OS X Tiger" ;; - "10.5."*) codename="Mac OS X Leopard" ;; - "10.6."*) codename="Mac OS X Snow Leopard" ;; - "10.7."*) codename="Mac OS X Lion" ;; - "10.8."*) codename="OS X Mountain Lion" ;; - "10.9."*) codename="OS X Mavericks" ;; - "10.10."*) codename="OS X Yosemite" ;; - "10.11."*) codename="OS X El Capitan" ;; + "10.4") codename="Mac OS X Tiger" ;; + "10.5") codename="Mac OS X Leopard" ;; + "10.6") codename="Mac OS X Snow Leopard" ;; + "10.7") codename="Mac OS X Lion" ;; + "10.8") codename="OS X Mountain Lion" ;; + "10.9") codename="OS X Mavericks" ;; + "10.10") codename="OS X Yosemite" ;; + "10.11") codename="OS X El Capitan" ;; *) codename="Mac OS X" ;; esac distro="$codename $osx_version" From ff2183680ccd25b814bdd3056b1900c0ae046030 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 23:35:43 +1100 Subject: [PATCH 12/12] Keep the full version in output --- neofetch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neofetch b/neofetch index df5d971d..e0025b0a 100755 --- a/neofetch +++ b/neofetch @@ -469,9 +469,8 @@ case "$os" in "Mac OS X") osx_version=$(sw_vers -productVersion) - osx_version=${osx_version%.*} - case "$osx_version" in + case "${osx_version%.*}" in "10.4") codename="Mac OS X Tiger" ;; "10.5") codename="Mac OS X Leopard" ;; "10.6") codename="Mac OS X Snow Leopard" ;;