From 8e29cd00b35862c998e79671adad5604d2ce25c6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 23 Dec 2017 22:20:50 +1100 Subject: [PATCH 1/4] gpu [linux]: Add clock speed --- neofetch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index acf517e4..dcb9ecda 100755 --- a/neofetch +++ b/neofetch @@ -1212,7 +1212,7 @@ get_gpu() { # Read GPUs into array. IFS=$'\n' gpus=($(lspci -mm | awk -F '\\"|\\" \\"|\\(' \ - '/"Display|"3D|"VGA/ {a[$0] = $3 " " $4} END{for(i in a) + '/"Display|"3D|"VGA/ {a[$0] = $1 $3 " " $4} END{for(i in a) {if(!seen[a[i]]++) print a[i]}}')) IFS="$old_ifs" @@ -1225,6 +1225,8 @@ get_gpu() { [[ "$gpu_type" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \ { unset -v gpu; continue; } + freq="$(< /sys/devices/pci0000\:00/0000\:"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)" + case "$gpu" in *"advanced"*) gpu="${gpu/'[AMD/ATI]' }" @@ -1267,6 +1269,10 @@ get_gpu() { fi prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu" + + [[ "$gpu_freq" == "on" && "$freq" ]] && \ + prin "GPU Frequency" "${freq}Mhz" + ((++gpu_num)) done From 0e59d6c041fed14a28cadc6ffb73887fbe422bb7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 23 Dec 2017 22:25:13 +1100 Subject: [PATCH 2/4] gpu [linux]: Add clock speed --- neofetch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index dcb9ecda..c6da59d0 100755 --- a/neofetch +++ b/neofetch @@ -1225,7 +1225,6 @@ get_gpu() { [[ "$gpu_type" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \ { unset -v gpu; continue; } - freq="$(< /sys/devices/pci0000\:00/0000\:"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)" case "$gpu" in *"advanced"*) @@ -1246,6 +1245,8 @@ get_gpu() { ;; *"intel"*) + freq="$(< /sys/devices/pci0000:00/0000:"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)" + type -p glxinfo >/dev/null && \ gpu="$(glxinfo | grep "Device:.*Intel")" @@ -1270,7 +1271,7 @@ get_gpu() { prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu" - [[ "$gpu_freq" == "on" && "$freq" ]] && \ + [[ "${gpu_freq:-on}" == "on" && "$freq" ]] && \ prin "GPU Frequency" "${freq}Mhz" ((++gpu_num)) From efa9ff672607cc3047bf2abc428b83e93c6d92c8 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 23 Dec 2017 22:28:13 +1100 Subject: [PATCH 3/4] gpu [linux]: Add clock speed --- neofetch | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/neofetch b/neofetch index c6da59d0..9c54a388 100755 --- a/neofetch +++ b/neofetch @@ -1225,7 +1225,6 @@ get_gpu() { [[ "$gpu_type" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \ { unset -v gpu; continue; } - case "$gpu" in *"advanced"*) gpu="${gpu/'[AMD/ATI]' }" @@ -1269,10 +1268,7 @@ get_gpu() { gpu="${gpu/Intel }" fi - prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu" - - [[ "${gpu_freq:-on}" == "on" && "$freq" ]] && \ - prin "GPU Frequency" "${freq}Mhz" + prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu ${freq:+@ ${freq}Mhz}" ((++gpu_num)) done From c902c2d69ea6db7554c1deb194d874eb51d2c3f2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 23 Dec 2017 22:35:25 +1100 Subject: [PATCH 4/4] general: Fix travis --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9c54a388..e71c979a 100755 --- a/neofetch +++ b/neofetch @@ -1244,7 +1244,9 @@ get_gpu() { ;; *"intel"*) - freq="$(< /sys/devices/pci0000:00/0000:"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)" + # (sorry) + freq="$(< /sys/devices/pci0000:00/0000:\ +"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)" type -p glxinfo >/dev/null && \ gpu="$(glxinfo | grep "Device:.*Intel")"