From 7e94fec6fcf9f9f21407f42c17fad82b32cb2bf4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 29 Aug 2017 09:22:56 +1000 Subject: [PATCH 1/3] gpu_driver: Add linux support. --- config/config.conf | 3 ++- config/travis.conf | 1 + neofetch | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/config.conf b/config/config.conf index 64dfd1a3..85162e7c 100644 --- a/config/config.conf +++ b/config/config.conf @@ -26,6 +26,7 @@ print_info() { info "GPU" gpu info "Memory" memory + # info "GPU Driver" gpu_driver # Linux only # info "CPU Usage" cpu_usage # info "Disk" disk # info "Battery" battery @@ -35,7 +36,7 @@ print_info() { # info "Public IP" public_ip # info "Users" users # info "Install Date" install_date - # info "Locale" locale # This only works on glibc systems. + # info "Locale" locale # This only works on glibc systems. info line_break info cols diff --git a/config/travis.conf b/config/travis.conf index 137de46e..0dada093 100644 --- a/config/travis.conf +++ b/config/travis.conf @@ -21,6 +21,7 @@ print_info() { info "Terminal Font" term_font info "CPU" cpu info "GPU" gpu + info "GPU Driver" gpu_driver info "Memory" memory info "CPU Usage" cpu_usage diff --git a/neofetch b/neofetch index fe158167..638f161d 100755 --- a/neofetch +++ b/neofetch @@ -2258,6 +2258,14 @@ get_locale() { locale="$sys_locale" } +get_gpu_driver() { + case "$os" in + "Linux") + gpu_driver="$(lspci -nnk | awk -F ': ' '/VGA/{nr[NR+2]}; NR in nr {print $2}')" + ;; + esac +} + get_cols() { if [[ "$color_blocks" == "on" ]]; then # Convert the width to space chars. From 0ef25b5f804a14777b38286c41bdb1bace883215 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 29 Aug 2017 09:25:01 +1000 Subject: [PATCH 2/3] gpu_driver: Show multiple drivers if multiple gpus found --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 638f161d..a953a60b 100755 --- a/neofetch +++ b/neofetch @@ -2261,7 +2261,8 @@ get_locale() { get_gpu_driver() { case "$os" in "Linux") - gpu_driver="$(lspci -nnk | awk -F ': ' '/VGA/{nr[NR+2]}; NR in nr {print $2}')" + gpu_driver="$(lspci -nnk | awk -F ': ' '/Display|3D|VGA/{nr[NR+2]}; NR in nr {printf $2 ", "}')" + gpu_driver="${gpu_driver%, }" ;; esac } From 6c347611ecd43c02313c743e03325004110fec62 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 29 Aug 2017 09:34:40 +1000 Subject: [PATCH 3/3] general: Fix line length --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index a953a60b..872554e9 100755 --- a/neofetch +++ b/neofetch @@ -2261,7 +2261,8 @@ get_locale() { get_gpu_driver() { case "$os" in "Linux") - gpu_driver="$(lspci -nnk | awk -F ': ' '/Display|3D|VGA/{nr[NR+2]}; NR in nr {printf $2 ", "}')" + gpu_driver="$(lspci -nnk | awk -F ': ' \ + '/Display|3D|VGA/{nr[NR+2]}; NR in nr {printf $2 ", "}')" gpu_driver="${gpu_driver%, }" ;; esac