From 78fe905a09f5da60eddc6d88902a5359853505ad Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Tue, 3 Jul 2018 17:26:46 -0400 Subject: [PATCH] Show graphics card (NVIDIA) temp and mem usage --- bin/khatus_show | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bin/khatus_show b/bin/khatus_show index f008d19..c0a41a1 100755 --- a/bin/khatus_show +++ b/bin/khatus_show @@ -355,11 +355,29 @@ mpd_current_file=$( ' ) +graphics_card=$( + nvidia-smi \ + --format=csv,noheader,nounits \ + --query-gpu=memory.total,memory.used,temperature.gpu \ + | awk -F ',' ' + { + mem_total = $1; + mem_used = $2; + temp = $3; + mem_used_percent = (100 * mem_used) / mem_total; + printf("[%d%% %dC]", mem_used_percent, temp); + } + ' +) + echo \ "\ E$energy\ \ \ + G=$graphics_card\ + \ + \ M$memory\ \ \ -- 2.20.1