1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 08:08:00 +00:00

[polybar] Fix python issues with cpu_usage.py

This commit is contained in:
Daniel Carrillo 2023-06-30 19:48:49 +02:00
parent 3902d4f59a
commit 0f9d10ef4e
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16

View File

@ -26,11 +26,11 @@ def show_cpu_usage():
bar = ''
global_count = 0
for usage in cpu_usage.split(','):
value, key = str.lstrip(usage).split(' ')
count = round(float(value) / 10)
if count > 0 and key != 'id':
values = str.lstrip(usage).split(' ')
count = round(float(values[0]) / 10)
if count > 0 and values[1] != 'id':
global_count += count
bar += '%{F' + colors[key] + '}' + '_' * count + '%{F-}'
bar += '%{F' + colors[values[1]] + '}' + '_' * count + '%{F-}'
padding = ''
if global_count < 10: