Support for desktop

This commit is contained in:
Thomas Forgione 2025-04-16 09:52:35 +02:00
parent 75eea377c6
commit d2383ed1b9
2 changed files with 20 additions and 11 deletions

View File

@ -164,6 +164,10 @@ def monitor_stats():
cpu_values[-1] = cpu_percent
mem_values[-1] = mem_percent
if battery is None:
battery_json = '{"text": "", "class": "hidden"}'
else:
battery_index = round(battery.percent / 10)
battery_icon = batteries_charging[battery_index] if battery.power_plugged else batteries[battery_index]
@ -177,12 +181,13 @@ def monitor_stats():
battery_class = None
battery_json = f', "class": "{battery_class}"' if battery_class else ''
battery_json = '{"text": "' + battery_icon + ' ' + "% 3.0f"%battery.percent + '%"' + battery_json + '}'
with open('.stat.txt', 'w') as f:
f.write(
' ' + ''.join([to_bar(x) for x in cpu_values]) + ' ' + "% 5.1f"%cpu_percent + '%\n' +
' ' + ''.join([to_bar(x) for x in mem_values]) + ' ' + "% 5.1f"%mem_percent + '%\n' +
'{"text": "' + battery_icon + ' ' + "% 3.0f"%battery.percent + '%"' + battery_json + '}'
battery_json
)

View File

@ -125,6 +125,10 @@ button:hover {
color: @red;
}
#custom-battery.hidden {
padding: 0;
}
#network {
color: @yellow;
}