From e9c8e6c2a37be1a932c375d4165a5059cfa6e8c8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 01:45:46 +0100 Subject: [PATCH 01/27] Add font detection for iTerm2 --- neofetch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/neofetch b/neofetch index 2d649d88..c725aa78 100755 --- a/neofetch +++ b/neofetch @@ -1644,6 +1644,25 @@ get_term_font() { term_font="$(osascript -e 'tell application "Terminal" to font name of window frontmost')" ;; + "iTerm2") + local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') + + # Count Guids in "New Bookmarks"; they should be unique + local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist | grep "Guid" | wc -l) + for idx in $(seq 0 ${profilesCount}); do + local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist) + if [[ "${profileName}" == "${currentProfileName}" ]]; then + # "Normal Font" + term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + # Font for non-ascii characters + local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + if [[ "$term_font" -ne "$nonAsciiFont" ]]; then + term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" + fi + fi + done + ;; + "deepin-terminal"*) term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END{print a " " b}' "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")" ;; From 4387233378c312648d00d09c0e5bb1c7a114cef8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 01:46:22 +0100 Subject: [PATCH 02/27] Add warning that false positives can occur --- neofetch | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neofetch b/neofetch index c725aa78..2d75b0da 100755 --- a/neofetch +++ b/neofetch @@ -1655,6 +1655,12 @@ get_term_font() { # "Normal Font" term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) # Font for non-ascii characters + # This font setting may differ from normal font, but this might be a false + # positive, as there is a setting to use a different font for non-ascii + # characters and this setting does not get updated when flipping the switch. + # So it might be that the user checked the mark to use a different font, + # selected one, but then decided to uncheck the "use different font" mark + # again. local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) if [[ "$term_font" -ne "$nonAsciiFont" ]]; then term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" From eec7f08eee961462e5c0fa7b2582a57b991cd1c5 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 01:50:17 +0100 Subject: [PATCH 03/27] Add warning about possible profile name collisions --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index 2d75b0da..9d54041e 100755 --- a/neofetch +++ b/neofetch @@ -1645,6 +1645,10 @@ get_term_font() { ;; "iTerm2") + # Unfortunately the profile name is not unique, but it seems to be the only thing + # that identifies an active profile. There is the "id of current session of current window" + # thou, but that does not match to a guid in the plist. + # So, be warned! Collisions may occur! local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') # Count Guids in "New Bookmarks"; they should be unique From e2d1cb27a518cb52770479d3675c198822e49d6e Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 01:56:29 +0100 Subject: [PATCH 04/27] Fix comparison --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9d54041e..10bf0373 100755 --- a/neofetch +++ b/neofetch @@ -1666,7 +1666,7 @@ get_term_font() { # selected one, but then decided to uncheck the "use different font" mark # again. local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) - if [[ "$term_font" -ne "$nonAsciiFont" ]]; then + if [[ "$term_font" != "$nonAsciiFont" ]]; then term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" fi fi From 3cf7c5ffa27222a51464881a056cf1b55a14eb86 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 02:17:36 +0100 Subject: [PATCH 05/27] Only print non-ascii font if switch "use different font" is active --- neofetch | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 10bf0373..41dc8add 100755 --- a/neofetch +++ b/neofetch @@ -1659,15 +1659,14 @@ get_term_font() { # "Normal Font" term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) # Font for non-ascii characters - # This font setting may differ from normal font, but this might be a false - # positive, as there is a setting to use a different font for non-ascii - # characters and this setting does not get updated when flipping the switch. - # So it might be that the user checked the mark to use a different font, - # selected one, but then decided to uncheck the "use different font" mark - # again. - local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) - if [[ "$term_font" != "$nonAsciiFont" ]]; then - term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" + # Only check for a different non-ascii font, if the user checked + # the "use a different font for non-ascii text" switch. + local useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + if [[ "$useDifferentFont" == "true" ]]; then + local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + if [[ "$term_font" != "$nonAsciiFont" ]]; then + term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" + fi fi fi done From d1e81f3344a6b1f04a26dfd6e5d0b8575695ed84 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 02:28:23 +0100 Subject: [PATCH 06/27] Add reference to post on iTerm2 list because of ambiguous active profile name --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 41dc8add..d6375e9c 100755 --- a/neofetch +++ b/neofetch @@ -1649,6 +1649,7 @@ get_term_font() { # that identifies an active profile. There is the "id of current session of current window" # thou, but that does not match to a guid in the plist. # So, be warned! Collisions may occur! + # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') # Count Guids in "New Bookmarks"; they should be unique From 38641c690e101e13b2bc4d2bc50b02f10cb60421 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 02:30:53 +0100 Subject: [PATCH 07/27] Add warning about iTerm2s dynamic profiles --- neofetch | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neofetch b/neofetch index d6375e9c..f5162593 100755 --- a/neofetch +++ b/neofetch @@ -1652,6 +1652,9 @@ get_term_font() { # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') + # Warning: Dynamic profiles are not taken into account here! + # https://www.iterm2.com/documentation-dynamic-profiles.html + # Count Guids in "New Bookmarks"; they should be unique local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist | grep "Guid" | wc -l) for idx in $(seq 0 ${profilesCount}); do From 24283be05d8df6b8b9efea8c3ab81f12b2d18724 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 2 Mar 2017 18:35:13 +0100 Subject: [PATCH 08/27] Mute error message, when PlistBuddy is not installed PlistBuddy is part of XCode. It may be that users don't have it installed. --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index f5162593..c8b23e26 100755 --- a/neofetch +++ b/neofetch @@ -1656,9 +1656,9 @@ get_term_font() { # https://www.iterm2.com/documentation-dynamic-profiles.html # Count Guids in "New Bookmarks"; they should be unique - local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist | grep "Guid" | wc -l) + local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep "Guid" | wc -l) for idx in $(seq 0 ${profilesCount}); do - local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist) + local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null) if [[ "${profileName}" == "${currentProfileName}" ]]; then # "Normal Font" term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) From 569bef567fe4f2d17c34f2f9fd36d7490b772e0e Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Fri, 3 Mar 2017 00:04:19 +0100 Subject: [PATCH 09/27] Fix code style --- neofetch | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index c8b23e26..dd087428 100755 --- a/neofetch +++ b/neofetch @@ -1650,24 +1650,29 @@ get_term_font() { # thou, but that does not match to a guid in the plist. # So, be warned! Collisions may occur! # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg - local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') + local currentProfileName + currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') # Warning: Dynamic profiles are not taken into account here! # https://www.iterm2.com/documentation-dynamic-profiles.html # Count Guids in "New Bookmarks"; they should be unique - local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep "Guid" | wc -l) - for idx in $(seq 0 ${profilesCount}); do - local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null) + local profilesCount + profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid") + for idx in $(seq 0 "${profilesCount}"); do + local profileName + profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null) if [[ "${profileName}" == "${currentProfileName}" ]]; then # "Normal Font" term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) # Font for non-ascii characters # Only check for a different non-ascii font, if the user checked # the "use a different font for non-ascii text" switch. - local useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + local useDifferentFont + useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) if [[ "$useDifferentFont" == "true" ]]; then - local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + local nonAsciiFont + nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) if [[ "$term_font" != "$nonAsciiFont" ]]; then term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" fi From 53eafeb4145d1312742ec550e9a701fd7d451502 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 8 Mar 2017 23:19:03 +0100 Subject: [PATCH 10/27] Fix code style --- neofetch | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/neofetch b/neofetch index dd087428..20c88ac9 100755 --- a/neofetch +++ b/neofetch @@ -1650,32 +1650,31 @@ get_term_font() { # thou, but that does not match to a guid in the plist. # So, be warned! Collisions may occur! # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg - local currentProfileName - currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') + local current_profile_name + current_profile_name="$(osascript -e 'tell application "iTerm2" to profile name of current session of current window')" # Warning: Dynamic profiles are not taken into account here! # https://www.iterm2.com/documentation-dynamic-profiles.html # Count Guids in "New Bookmarks"; they should be unique - local profilesCount - profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid") - for idx in $(seq 0 "${profilesCount}"); do - local profileName - profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null) - if [[ "${profileName}" == "${currentProfileName}" ]]; then + local profiles_count + profiles_count="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid")" + for ((i=0; i<=profiles_count; i++)); do + local profile_name + profile_name="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null)" + if [[ "$profile_name" == "$current_profile_name" ]]; then # "Normal Font" - term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) + term_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" # Font for non-ascii characters # Only check for a different non-ascii font, if the user checked # the "use a different font for non-ascii text" switch. - local useDifferentFont - useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) - if [[ "$useDifferentFont" == "true" ]]; then - local nonAsciiFont - nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) - if [[ "$term_font" != "$nonAsciiFont" ]]; then - term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" - fi + local use_different_font + use_different_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" + if [[ "$use_different_font" == "true" ]]; then + local non_ascii_font + non_ascii_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" + [[ "$term_font" != "$non_ascii_font" ]] && \ + term_font="$term_font (normal) / $non_ascii_font (non-ascii)" fi fi done From 8c783d63a2e195cf9674a405248bb899ab8308e1 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 9 Mar 2017 01:13:31 +0100 Subject: [PATCH 11/27] Add newlines --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index 20c88ac9..c2f7b908 100755 --- a/neofetch +++ b/neofetch @@ -1659,9 +1659,11 @@ get_term_font() { # Count Guids in "New Bookmarks"; they should be unique local profiles_count profiles_count="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid")" + for ((i=0; i<=profiles_count; i++)); do local profile_name profile_name="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null)" + if [[ "$profile_name" == "$current_profile_name" ]]; then # "Normal Font" term_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" @@ -1670,11 +1672,13 @@ get_term_font() { # the "use a different font for non-ascii text" switch. local use_different_font use_different_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" + if [[ "$use_different_font" == "true" ]]; then local non_ascii_font non_ascii_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" [[ "$term_font" != "$non_ascii_font" ]] && \ term_font="$term_font (normal) / $non_ascii_font (non-ascii)" + fi fi done From 8d250e41bac80c923851cda7edd9ecb7f526d676 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 9 Mar 2017 01:17:31 +0100 Subject: [PATCH 12/27] Fix newlines --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index c2f7b908..67bd6ed7 100755 --- a/neofetch +++ b/neofetch @@ -1676,9 +1676,9 @@ get_term_font() { if [[ "$use_different_font" == "true" ]]; then local non_ascii_font non_ascii_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)" + [[ "$term_font" != "$non_ascii_font" ]] && \ term_font="$term_font (normal) / $non_ascii_font (non-ascii)" - fi fi done From d8561cceed7b4cd47da2e94db6d9ea39a74ef1cb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 9 Mar 2017 11:47:52 +1100 Subject: [PATCH 13/27] CPU: Show an additional digit in cpu speed --- neofetch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index b63788aa..16126600 100755 --- a/neofetch +++ b/neofetch @@ -810,11 +810,11 @@ get_cpu() { speed="$(< "${speed_dir}/bios_limit")" || \ speed="$(< "${speed_dir}/scaling_max_freq")" || \ speed="$(< "${speed_dir}/cpuinfo_max_freq")" - speed="$((speed / 100000))" + speed="$((speed / 10000))" else speed="$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)" - speed="$((speed / 100))" + speed="$((speed / 10))" fi # Get CPU temp. @@ -882,7 +882,7 @@ get_cpu() { # Get CPU speed. speed="$(sysctl -n hw.cpuspeed)" [[ -z "$speed" ]] && speed="$(sysctl -n hw.clockrate)" - speed="$((speed / 100))" + speed="$((speed / 10))" # Get CPU cores. cores="$(sysctl -n hw.ncpu)" @@ -920,7 +920,7 @@ get_cpu() { # Get CPU speed. speed="$(psrinfo -v | awk '/operates at/ {print $6; exit}')" - speed="$((speed / 100))" + speed="$((speed / 10))" # Get CPU cores. case "$cpu_cores" in @@ -937,7 +937,7 @@ get_cpu() { # Get CPU speed. speed="$(sysinfo -cpu | awk '/running at/ {print $NF; exit}')" speed="${speed/MHz}" - speed="$((speed / 100))" + speed="$((speed / 10))" # Get CPU cores. cores="$(sysinfo -cpu | grep -c -F 'CPU #')" @@ -950,7 +950,7 @@ get_cpu() { # Get CPU speed. speed="$(prtconf | awk -F':' '/Processor Clock Speed/ {printf $2}')" speed="${speed/MHz}" - speed="$((speed / 100))" + speed="$((speed / 10))" # Get CPU cores. case "$cpu_cores" in From 30a6d8641b42192d11317a43cb7f6d959c160c6a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 9 Mar 2017 12:03:17 +1100 Subject: [PATCH 14/27] CPU: Added speed_shorthand to toggle showing decimals in the output --- config/config | 11 +++++++++++ neofetch | 15 ++++++++------- neofetch.1 | 7 +++++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/config/config b/config/config index 2a57fe3f..d1621962 100644 --- a/config/config +++ b/config/config @@ -138,6 +138,17 @@ shell_version="on" # NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. speed_type="bios_limit" +# CPU speed shorthand +# +# Default: 'off' +# Values: 'on', 'off'. +# Flag: --speed_shorthand. +# +# Example: +# on: 'i7-6500U (4) @ 3.1GHz' +# off: 'i7-6500U (4) @ 3.100GHz' +speed_shorthand="off" + # Shorten the output of the CPU function # # Default: 'off' diff --git a/neofetch b/neofetch index 16126600..6a045651 100755 --- a/neofetch +++ b/neofetch @@ -810,11 +810,10 @@ get_cpu() { speed="$(< "${speed_dir}/bios_limit")" || \ speed="$(< "${speed_dir}/scaling_max_freq")" || \ speed="$(< "${speed_dir}/cpuinfo_max_freq")" - speed="$((speed / 10000))" + speed="$((speed / 1000))" else speed="$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)" - speed="$((speed / 10))" fi # Get CPU temp. @@ -882,7 +881,6 @@ get_cpu() { # Get CPU speed. speed="$(sysctl -n hw.cpuspeed)" [[ -z "$speed" ]] && speed="$(sysctl -n hw.clockrate)" - speed="$((speed / 10))" # Get CPU cores. cores="$(sysctl -n hw.ncpu)" @@ -920,7 +918,6 @@ get_cpu() { # Get CPU speed. speed="$(psrinfo -v | awk '/operates at/ {print $6; exit}')" - speed="$((speed / 10))" # Get CPU cores. case "$cpu_cores" in @@ -937,7 +934,6 @@ get_cpu() { # Get CPU speed. speed="$(sysinfo -cpu | awk '/running at/ {print $NF; exit}')" speed="${speed/MHz}" - speed="$((speed / 10))" # Get CPU cores. cores="$(sysinfo -cpu | grep -c -F 'CPU #')" @@ -950,7 +946,6 @@ get_cpu() { # Get CPU speed. speed="$(prtconf | awk -F':' '/Processor Clock Speed/ {printf $2}')" speed="${speed/MHz}" - speed="$((speed / 10))" # Get CPU cores. case "$cpu_cores" in @@ -960,8 +955,12 @@ get_cpu() { ;; esac - # Fix for speeds under 1ghz. if [[ "$speed" ]]; then + # Hide decimals if on. + [[ "$speed_shorthand" == "on" ]] && \ + speed="$((speed / 100))" + + # Fix for speeds under 1ghz. if [[ -z "${speed:1}" ]]; then speed="0.${speed}" else @@ -3739,6 +3738,7 @@ INFO: NOTE: This only supports Linux with cpufreq. + --speed_shorthand on/off Whether or not to show decimals in CPU speed. --cpu_shorthand type Shorten the output of CPU Possible values: name, speed, tiny, on, off --cpu_cores type Whether or not to display the number of CPU cores @@ -3944,6 +3944,7 @@ get_args() { "--cpu_cores") cpu_cores="$2" ;; "--cpu_speed") cpu_speed="$2" ;; "--speed_type") speed_type="$2" ;; + "--speed_shorthand") speed_shorthand="$2" ;; "--distro_shorthand") distro_shorthand="$2" ;; "--kernel_shorthand") kernel_shorthand="$2" ;; "--uptime_shorthand") uptime_shorthand="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index a51742df..245cbbb7 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH NEOFETCH "1" "February 2017" "Neofetch 3.0.2" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.1. +.TH NEOFETCH "1" "March 2017" "Neofetch 3.0.2" "User Commands" .SH NAME Neofetch \- A fast, highly customizable system info script .SH SYNOPSIS @@ -30,6 +30,9 @@ scaling_current, scaling_min, scaling_max .IP NOTE: This only supports Linux with cpufreq. .TP +\fB\-\-speed_shorthand\fR on/off +Whether or not to show decimals in CPU speed. +.TP \fB\-\-cpu_shorthand\fR type Shorten the output of CPU Possible values: name, speed, tiny, on, off From 7bf8f1785437c61327761e4a380627cba77c8722 Mon Sep 17 00:00:00 2001 From: Niles Rogoff Date: Thu, 9 Mar 2017 10:55:06 -0800 Subject: [PATCH 15/27] Slitaz support added --- ascii/distro/slitaz | 17 +++++++++++++++++ neofetch | 11 +++++++++++ 2 files changed, 28 insertions(+) create mode 100644 ascii/distro/slitaz diff --git a/ascii/distro/slitaz b/ascii/distro/slitaz new file mode 100644 index 00000000..5ee52706 --- /dev/null +++ b/ascii/distro/slitaz @@ -0,0 +1,17 @@ +${c1} @ @( @ + @@ @@ @ @/ + @@ @@ @@ @@ + @@ %@@ @@ @@ + @@ %@@@ @@@@@. @@@@ @@ + @@@ @@@@ @@@@@@@ &@@@ @@@ + @@@@@@@ %@@@@@@@@@@@@ &@@@% @@@@@@@/ + ,@@@@@@@@@@@@@@@@@@@@@@@@@ + .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/ +@@@@@@. @@@@@@@@@@@@@@@@@@@@@ /@@@@@@ +@@ @@@@@ @@@@@@@@@@@@, @@@@@ @@@ +@@ @@@@. @@@@@@@@@@@@@% #@@@@ @@. +@@ ,@@ @@@@@@@@@@@@@ @@@ @@ +@ @@. @@@@@@@@@@@@@ @@@ *@ +@ @@ @@@@@@@@@@@@ @@ @ + @ @@@@@@@@@. #@ + @ ,@@@@@ @ diff --git a/neofetch b/neofetch index 8f24e1d0..0fc48840 100755 --- a/neofetch +++ b/neofetch @@ -93,6 +93,9 @@ get_distro() { "tiny") distro="${distro//version*}" ;; esac + elif type -p tazpkg >/dev/null; then + distro="SliTaz $(cat /etc/slitaz-release)" + elif [[ -d "/system/app/" && -d "/system/priv-app" ]]; then distro="Android $(getprop ro.build.version.release)" @@ -476,6 +479,9 @@ get_packages() { type -p crew >/dev/null && \ packages="$((packages+=$(ls -l /usr/local/etc/crew/meta/*.filelist | wc -l)))" + type -p tazpkg >/dev/null && \ + packages="$(($(tazpkg list|wc -l)-6))" + if type -p pkg >/dev/null; then case "$kernel_name" in "FreeBSD") packages="$((packages+=$(pkg info | wc -l)))" ;; @@ -3150,6 +3156,11 @@ get_distro_colors() { ascii_file="slackware" ;; + "SliTaz"*) + set_colors 3 3 + ascii_file="slitaz" + ;; + "SmartOS"*) set_colors 6 7 ascii_file="smartos" From ce7ef1937254fbf7518a5af87c98f8fc02ce60a3 Mon Sep 17 00:00:00 2001 From: Niles Rogoff Date: Thu, 9 Mar 2017 13:27:16 -0800 Subject: [PATCH 16/27] Correct style --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 0fc48840..79ab5041 100755 --- a/neofetch +++ b/neofetch @@ -94,7 +94,7 @@ get_distro() { esac elif type -p tazpkg >/dev/null; then - distro="SliTaz $(cat /etc/slitaz-release)" + distro="SliTaz $(< /etc/slitaz-release)" elif [[ -d "/system/app/" && -d "/system/priv-app" ]]; then distro="Android $(getprop ro.build.version.release)" @@ -480,7 +480,7 @@ get_packages() { packages="$((packages+=$(ls -l /usr/local/etc/crew/meta/*.filelist | wc -l)))" type -p tazpkg >/dev/null && \ - packages="$(($(tazpkg list|wc -l)-6))" + packages="$((packages+=$(tazpkg list | wc -l) - 6))" if type -p pkg >/dev/null; then case "$kernel_name" in From fd3d2fc29bba2ab05a861d4ccfa0d79622f7390f Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Fri, 10 Mar 2017 10:43:21 +0700 Subject: [PATCH 17/27] Docs: Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65667d3a..122510eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ - **[@jorgegonzalez](https://github.com/jorgegonzalez)** - **[@ikeydoherty](https://github.com/ikeydoherty)** - **[@eliezio](https://github.com/eliezio)** +- **[@nilesr](https://github.com/nilesr)** + +## Operating System + +- Added support for SliTaz. **[@nilesr](https://github.com/nilesr)** ## Ascii From 91a7bd4737757ac09a317242e80a5baaa5a242e7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 15 Mar 2017 21:27:16 +1100 Subject: [PATCH 18/27] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 122510eb..795ebff5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - **[@ikeydoherty](https://github.com/ikeydoherty)** - **[@eliezio](https://github.com/eliezio)** - **[@nilesr](https://github.com/nilesr)** +- **[@dritter](https://github.com/dritter)** + ## Operating System @@ -26,6 +28,10 @@ ## Info +**Terminal Font**
+ +- Added \*experimental\* font detection for iTerm2. **[@dritter](https://github.com/dritter)** + **Window Manager**
- [MacOS] Added support for Kwm. **[@jorgegonzalez](https://github.com/jorgegonzalez)** From 1bd185874c3afde2f485ec51850da3a5f32e06ef Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Tue, 21 Mar 2017 13:45:23 -0400 Subject: [PATCH 19/27] WM: Add support for Amethyst on macOS --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 9b5a23d9..60f6c7b2 100755 --- a/neofetch +++ b/neofetch @@ -638,6 +638,7 @@ get_wm() { "Mac OS X") wm="Quartz Compositor" ps -e | grep -q '[S]pectacle' && wm='Spectacle' + ps -e | grep -q "[A]methyst" && wm="Amethyst" ps -e | grep -q "[k]wm" && wm="Kwm" ;; From 0c4d4eb23aeb6168410d8a2134bb626c43613ede Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Tue, 21 Mar 2017 18:37:41 -0400 Subject: [PATCH 20/27] Reduce macOS WM detections to one ps call --- neofetch | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 60f6c7b2..79c9e71c 100755 --- a/neofetch +++ b/neofetch @@ -636,10 +636,17 @@ get_wm() { else case "$os" in "Mac OS X") - wm="Quartz Compositor" - ps -e | grep -q '[S]pectacle' && wm='Spectacle' - ps -e | grep -q "[A]methyst" && wm="Amethyst" - ps -e | grep -q "[k]wm" && wm="Kwm" + ps_line="$(ps -e | grep -o '[S]pectacle\|[A]methyst\|[k]wm')" + + if echo "$ps_line" | grep -q "kwm"; then + wm="Kwm" + elif echo "$ps_line" | grep -q "Amethyst"; then + wm="Amethyst" + elif echo "$ps_line" | grep -q "Spectacle"; then + wm="Spectacle" + else + wm="Quartz Compositor" + fi ;; "Windows") From 6803b571b7ffaed77b3153133d36e883e0d9177b Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Tue, 21 Mar 2017 19:58:47 -0400 Subject: [PATCH 21/27] Change if statement to a switch --- neofetch | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 79c9e71c..0431b52f 100755 --- a/neofetch +++ b/neofetch @@ -638,15 +638,12 @@ get_wm() { "Mac OS X") ps_line="$(ps -e | grep -o '[S]pectacle\|[A]methyst\|[k]wm')" - if echo "$ps_line" | grep -q "kwm"; then - wm="Kwm" - elif echo "$ps_line" | grep -q "Amethyst"; then - wm="Amethyst" - elif echo "$ps_line" | grep -q "Spectacle"; then - wm="Spectacle" - else - wm="Quartz Compositor" - fi + case "$ps_line" in + *"kwm"*) wm="Kwm" ;; + *"Amethyst"*) wm="Amethyst" ;; + *"Spectacle"*) wm="Spectacle" ;; + *) wm="Quartz Compositor" ;; + esac ;; "Windows") From bfcab94391bc63bb3fb19f6b397115556f075eee Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 22 Mar 2017 14:29:20 +1100 Subject: [PATCH 22/27] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 795ebff5..6ba2c160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - [MacOS] Added support for Kwm. **[@jorgegonzalez](https://github.com/jorgegonzalez)** - [MacOS] Added support for Spectacle. **[@jorgegonzalez](https://github.com/jorgegonzalez)** +- [MacOS] Add support for Amethyst. **[@jorgegonzalez](https://github.com/jorgegonzalez)** **Song**
From adeb59173d2930503e511d0df194433377bbdc8d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 22 Mar 2017 14:29:50 +1100 Subject: [PATCH 23/27] Update CHANGELOG.md --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ba2c160..6d02ca3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,27 +28,27 @@ ## Info -**Terminal Font**
+**Terminal Font** - Added \*experimental\* font detection for iTerm2. **[@dritter](https://github.com/dritter)** -**Window Manager**
+**Window Manager** - [MacOS] Added support for Kwm. **[@jorgegonzalez](https://github.com/jorgegonzalez)** - [MacOS] Added support for Spectacle. **[@jorgegonzalez](https://github.com/jorgegonzalez)** - [MacOS] Add support for Amethyst. **[@jorgegonzalez](https://github.com/jorgegonzalez)** -**Song**
+**Song** - Fixed Audacious song output when `dbus-send` fails. **[@mstraube](https://github.com/mstraube)** -**Local IP**
+**Local IP** - [Linux] Fixed UID showing instead of Local IP on several versions/configs of iproute2. -**Packages**
+**Packages** - [eopkg] Used a faster detection method. **[@ikeydoherty](https://github.com/ikeydoherty)** -**Resolution**
+**Resolution** - [macOS] Fixed `screenresolution` not appearing at all on newer versions. **[@eliezio](https://github.com/eliezio)** - [Linux] Show decimals. From 7f732aef1ef9ae453e663b9d6646bb18da3e238e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 22 Mar 2017 15:18:36 +1100 Subject: [PATCH 24/27] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d02ca3f..2b145932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,10 @@ ## Info +**CPU** + +- Add option to show decimals in CPU speed. + **Terminal Font** - Added \*experimental\* font detection for iTerm2. **[@dritter](https://github.com/dritter)** From e92a03816e08610a139c40c52ad6beddeb19fde8 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 22 Mar 2017 11:07:59 +0100 Subject: [PATCH 25/27] OS: Add support for Nitrux --- ascii/distro/nitrux | 18 ++++++++++++++++++ neofetch | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 ascii/distro/nitrux diff --git a/ascii/distro/nitrux b/ascii/distro/nitrux new file mode 100644 index 00000000..2f49d638 --- /dev/null +++ b/ascii/distro/nitrux @@ -0,0 +1,18 @@ +${c1}`:/. +`/yo +`/yo +`/yo .+:. +`/yo .sys+:.` +`/yo `-/sys+:.` +`/yo ./sss+:.` +`/yo .:oss+:-` +`/yo ./o///:-` +`/yo `.-:///////:` +`/yo `.://///++//-`` +`/yo `.-:////++++/-` +`/yo `-://///++o+/-` +`/yo `-/+o+++ooo+/-` +`/s+:+oooossso/.` +`//+sssssso:. +`+syyyy+:` +:+s+- diff --git a/neofetch b/neofetch index ef4df704..7503934a 100755 --- a/neofetch +++ b/neofetch @@ -3065,6 +3065,11 @@ get_distro_colors() { ascii_file="netrunner" ;; + "Nitrux"*) + set_colors 4 + ascii_file="nitrux" + ;; + "NixOS"*) set_colors 4 6 ascii_file="nixos" From 012e2cbcb14808e10830e9d7397b4fa264d7ba2b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 23 Mar 2017 00:00:40 +1100 Subject: [PATCH 26/27] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b145932..7e9d86ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ## Operating System - Added support for SliTaz. **[@nilesr](https://github.com/nilesr)** +- Add support for Nitrux. **[@mstraube](https://github.com/mstraube)** ## Ascii From e1f2dcac9387e0ea5384d7eff0a11929660aa63b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 23 Mar 2017 00:00:48 +1100 Subject: [PATCH 27/27] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e9d86ea..933df38f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ ## Operating System - Added support for SliTaz. **[@nilesr](https://github.com/nilesr)** -- Add support for Nitrux. **[@mstraube](https://github.com/mstraube)** +- Added support for Nitrux. **[@mstraube](https://github.com/mstraube)** ## Ascii