'Sway bar status line generator.'
from json import dumps as json_dumps
from datetime import datetime
+from pathlib import Path
from time import sleep
METADATA = {'version': 1}
+PATH_THERMAL = Path('/sys/class/thermal')
+GLOB_THERMAL = 'thermal_zone*/temp'
if __name__ == '__main__':
print('[', end='')
while True:
print(json_dumps([
+ {'full_text': (
+ str(round(max(int(path.read_text(encoding='utf8'))
+ for path in PATH_THERMAL.glob(GLOB_THERMAL)
+ ) / 1000))
+ + '°C')},
{'full_text': str(datetime.now().isoformat(' ', 'seconds'))},
]), end=',\n', flush=True)
sleep(1)