#!/usr/bin/env python from datetime import datetime from zoneinfo import ZoneInfo from itertools import batched import json import time import sys def format_output(zones): # primary timezone primary = datetime.now(zones[0][1]).strftime(" %R") tooltip = None for label, zone in zones: if not tooltip: tooltip = "" else: tooltip += "\n" tooltip += f"{label}: {datetime.now(zone).strftime('%R %a %b %d %Z')}" tooltip += "" json.dump({"text": primary, "tooltip": tooltip}, sys.stdout) print(flush=True) def main(): if len(sys.argv) == 1 or len(sys.argv) % 2 == 0: print("usage: waybar-clock.py [