From 5b6196f1825a3ac7dd69e7eca11da3fc6aba4fc0 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 11 Mar 2016 08:27:00 +1100 Subject: [PATCH 1/4] added ability to shorten cpu output usage: --cpu_shorthand (name, model, name_model, speed) also edited config file to suit --- config/config | 5 +++++ neofetch | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/config/config b/config/config index 2fa40574..58fbde9f 100644 --- a/config/config +++ b/config/config @@ -93,6 +93,11 @@ shell_version="off" # scaling_current, scaling_min, scaling_max speed_type="max" +# CPU shorthand +# Decice to show name only, model only, or speed only +# --cpu_shorthand name, model, name_model, speed, off +cpu_shorthand="off" + # GPU diff --git a/neofetch b/neofetch index c1be7cec..62840bcd 100755 --- a/neofetch +++ b/neofetch @@ -113,6 +113,11 @@ shell_version="off" # scaling_current, scaling_min, scaling_max speed_type="max" +# CPU shorthand +# Decice to show name only, model only, or speed only +# --cpu_shorthand name, model, name_model, speed, off +cpu_shorthand="off" + # GPU @@ -855,6 +860,27 @@ getcpu () { cpu=${cpu// Six-Core} cpu=${cpu// Eight-Core} cpu=${cpu// with Radeon HD Graphics} + + # Make the output of cpu shorter + case "$cpu_shorthand" in + "name") + cpu=${cpu%-*} + ;; + + "model") + cpu=${cpu#*-} + cpu=${cpu%% *} + ;; + + "name_model") + cpu=${cpu%@*} + cpu=${cpu# } + ;; + + "speed") + cpu=${cpu#*@ } + ;; + esac } # }}} @@ -2295,6 +2321,8 @@ usage () { cat << EOF Possible values: current, min, max, bios, scaling_current, scaling_min, scaling_max NOTE: This only support Linux with cpufreq. + --cpu_shorthand type Shorten the output of CPU + Possible values: name, model, name_model, speed --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --gpu_shorthand on/off Shorten the output of GPU @@ -2396,6 +2424,7 @@ while [ "$1" ]; do --speed_type) speed_type="$2" ;; --kernel_shorthand) kernel_shorthand="$2" ;; --uptime_shorthand) uptime_shorthand="$2" ;; + --cpu_shorthand) cpu_shorthand="$2" ;; --gpu_shorthand) gpu_shorthand="$2" ;; --gtk_shorthand) gtk_shorthand="$2" ;; --gtk2) gtk2="$2" ;; From e0269fb9b6e91d0dc776a7151f696cbe28d85773 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 11 Mar 2016 08:49:01 +1100 Subject: [PATCH 2/4] added documentation for cpu_shorthand option --- 1.5.md | 2 ++ README.md | 2 ++ neofetch.1 | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/1.5.md b/1.5.md index e6d829b2..2845aa26 100644 --- a/1.5.md +++ b/1.5.md @@ -10,6 +10,8 @@ **Disk Usage**
- Only display usage of local disks. +**CPU Information**
+- Option to shorten CPU name to just name, model, name & model, or speed ### Ascii diff --git a/README.md b/README.md index f7bcf776..981e692b 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,8 @@ alias fetch2="fetch \ Possible values: current, min, max, bios, scaling_current, scaling_min, scaling_max NOTE: This only support Linux with cpufreq. + --cpu_shorthand type Shorten the output of CPU + Possible values: name, model, name_model, speed --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --gpu_shorthand on/off Shorten the output of GPU diff --git a/neofetch.1 b/neofetch.1 index f623f32c..0e8f9bdf 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -33,6 +33,11 @@ scaling_current, scaling_min, scaling_max .br NOTE: This only support Linux with cpufreq. .TP +.B \--cpu_shorthand 'type' +Shorten the output of CPU +.br +Possible values: name, model, name_model, speed +.TP .B \--kernel_shorthand 'on/off' Shorten the output of kernel .TP From d1f7c47e0c2972168589c1c7aed255dd706d9864 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 11 Mar 2016 10:33:37 +1100 Subject: [PATCH 3/4] changed cpu_frequency outputs with @dylanaraps suggestions --- 1.5.md | 2 +- README.md | 2 +- config/config | 4 ++-- neofetch | 31 +++++++++++++++++-------------- neofetch.1 | 2 +- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/1.5.md b/1.5.md index 2845aa26..8bde6482 100644 --- a/1.5.md +++ b/1.5.md @@ -11,7 +11,7 @@ **Disk Usage**
- Only display usage of local disks. **CPU Information**
-- Option to shorten CPU name to just name, model, name & model, or speed +- Option to shorten CPU name to just name, speed, tiny, on, or off ### Ascii diff --git a/README.md b/README.md index 981e692b..87e79c1f 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ alias fetch2="fetch \ scaling_current, scaling_min, scaling_max NOTE: This only support Linux with cpufreq. --cpu_shorthand type Shorten the output of CPU - Possible values: name, model, name_model, speed + Possible values: name, speed, tiny, on, off --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --gpu_shorthand on/off Shorten the output of GPU diff --git a/config/config b/config/config index 58fbde9f..6026ab9e 100644 --- a/config/config +++ b/config/config @@ -94,8 +94,8 @@ shell_version="off" speed_type="max" # CPU shorthand -# Decice to show name only, model only, or speed only -# --cpu_shorthand name, model, name_model, speed, off +# Decice to show name only, speed only, or short info +# --cpu_shorthand name, speed, tiny, on, off cpu_shorthand="off" diff --git a/neofetch b/neofetch index 62840bcd..f0a7b4ae 100755 --- a/neofetch +++ b/neofetch @@ -114,8 +114,8 @@ shell_version="off" speed_type="max" # CPU shorthand -# Decice to show name only, model only, or speed only -# --cpu_shorthand name, model, name_model, speed, off +# Decice to show name only, speed only, or short info +# --cpu_shorthand name, speed, tiny, on, off cpu_shorthand="off" @@ -864,22 +864,25 @@ getcpu () { # Make the output of cpu shorter case "$cpu_shorthand" in "name") - cpu=${cpu%-*} - ;; - - "model") - cpu=${cpu#*-} - cpu=${cpu%% *} - ;; - - "name_model") - cpu=${cpu%@*} - cpu=${cpu# } + cpu=${cpu/@*} ;; "speed") cpu=${cpu#*@ } ;; + + "on") + cpu=${cpu/Intel } + cpu=${cpu/Core } + cpu=${cpu/AMD } + ;; + + "tiny") + cpu=${cpu/Intel } + cpu=${cpu/Core } + cpu=${cpu/AMD } + cpu=${cpu/@*} + ;; esac } @@ -2322,7 +2325,7 @@ usage () { cat << EOF scaling_current, scaling_min, scaling_max NOTE: This only support Linux with cpufreq. --cpu_shorthand type Shorten the output of CPU - Possible values: name, model, name_model, speed + Possible values: name, speed, tiny, on, off --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --gpu_shorthand on/off Shorten the output of GPU diff --git a/neofetch.1 b/neofetch.1 index 0e8f9bdf..28f43ac2 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -36,7 +36,7 @@ NOTE: This only support Linux with cpufreq. .B \--cpu_shorthand 'type' Shorten the output of CPU .br -Possible values: name, model, name_model, speed +Possible values: name, speed, tiny, on, off .TP .B \--kernel_shorthand 'on/off' Shorten the output of kernel From 467ca792c99aa5247b36598491318b6b5a4ba5cb Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 11 Mar 2016 10:39:05 +1100 Subject: [PATCH 4/4] fixed duplicate case --- neofetch | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/neofetch b/neofetch index f0a7b4ae..effaf8a7 100755 --- a/neofetch +++ b/neofetch @@ -871,17 +871,15 @@ getcpu () { cpu=${cpu#*@ } ;; - "on") + "on" | "tiny") cpu=${cpu/Intel } cpu=${cpu/Core } + cpu=${cpu/Core? Duo } cpu=${cpu/AMD } - ;; - "tiny") - cpu=${cpu/Intel } - cpu=${cpu/Core } - cpu=${cpu/AMD } - cpu=${cpu/@*} + case "$cpu_shorthand" in + "tiny") cpu${cpu/@*} ;; + esac ;; esac }