From ccc26ed97f5b4953153454df53e619b6911434bb Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 4 May 2021 14:41:50 +0200 Subject: [sway/conky] use CPU total if not exactly 4 cores are available --- config/sway/conkyrc.json | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/config/sway/conkyrc.json b/config/sway/conkyrc.json index f3b2de0..32d3801 100644 --- a/config/sway/conkyrc.json +++ b/config/sway/conkyrc.json @@ -18,18 +18,23 @@ conky.text = [[ {"name": "cpuStart", "color" : "\#ffffff", "full_text": "CPU:", "separator": false}, - {"name": "cpu1", "color": ${if_match ${cpu cpu1}<89}"\#ffffff"${else}"\#ff0000"${endif}, - "full_text": "${cpu cpu1}%,", "separator": false}, + ${if_match "${exec nproc}"=="4"} + {"name": "cpu1", "color": ${if_match ${cpu cpu1}<89}"\#ffffff"${else}"\#ff0000"${endif}, + "full_text": "${cpu cpu1}%,", "separator": false}, - {"name": "cpu2", "color": ${if_match ${cpu cpu2}<89}"\#ffffff"${else}"\#ff0000"${endif}, + {"name": "cpu2", "color": ${if_match ${cpu cpu2}<89}"\#ffffff"${else}"\#ff0000"${endif}, - "full_text": "${cpu cpu2}%,", "separator": false}, + "full_text": "${cpu cpu2}%,", "separator": false}, - {"name": "cpu3", "color": ${if_match ${cpu cpu3}<89}"\#ffffff"${else}"\#ff0000"${endif}, - "full_text": "${cpu cpu3}%,", "separator": false}, + {"name": "cpu3", "color": ${if_match ${cpu cpu3}<89}"\#ffffff"${else}"\#ff0000"${endif}, + "full_text": "${cpu cpu3}%,", "separator": false}, - {"name": "cpu4", "color": ${if_match ${cpu cpu4}<89}"\#ffffff"${else}"\#ff0000"${endif}, - "full_text": "${cpu cpu4}%"}, + {"name": "cpu4", "color": ${if_match ${cpu cpu4}<89}"\#ffffff"${else}"\#ff0000"${endif}, + "full_text": "${cpu cpu4}%"}, + ${else} + {"name": "cpu", "color": ${if_match ${cpu cpu0}<89}"\#ffffff"${else}"\#ff0000"${endif}, + "full_text": "${cpu cpu0}%"}, + ${endif} ################ memory ######################### -- cgit v1.2.3