Better styling.
This commit is contained in:
parent
5ccac6de3a
commit
9245d95449
@ -95,6 +95,9 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-clock {
|
||||||
|
}
|
||||||
|
|
||||||
#cpu {
|
#cpu {
|
||||||
/* No styles */
|
/* No styles */
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class Update:
|
|||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
@lru_cache(maxsize=1)
|
||||||
def make_calendar(today: datetime.date):
|
def make_calendar(today: datetime.date, tz: datetime.tzinfo):
|
||||||
width: Final[int] = 20
|
width: Final[int] = 20
|
||||||
start_of_month = today.replace(day=1)
|
start_of_month = today.replace(day=1)
|
||||||
month_header = today.strftime("%B %Y")
|
month_header = today.strftime("%B %Y")
|
||||||
@ -50,6 +50,8 @@ def make_calendar(today: datetime.date):
|
|||||||
header = f"{left_padding}{month_header}{right_padding}"
|
header = f"{left_padding}{month_header}{right_padding}"
|
||||||
days_of_week = "Su Mo Tu We Th Fr Sa"
|
days_of_week = "Su Mo Tu We Th Fr Sa"
|
||||||
|
|
||||||
|
timezone_str = str(tz)
|
||||||
|
|
||||||
# Make the grid
|
# Make the grid
|
||||||
first_day_padding = " " * (
|
first_day_padding = " " * (
|
||||||
0 if start_of_month.weekday() == 6 else (3 * (1 + start_of_month.weekday())) - 1
|
0 if start_of_month.weekday() == 6 else (3 * (1 + start_of_month.weekday())) - 1
|
||||||
@ -63,11 +65,13 @@ def make_calendar(today: datetime.date):
|
|||||||
else:
|
else:
|
||||||
output += " "
|
output += " "
|
||||||
if print_day == today:
|
if print_day == today:
|
||||||
output += '<span foreground="blue">'
|
output += '<span foreground="#323232" background="#CCCCCC">'
|
||||||
output += f"{print_day.day: >2}"
|
output += f"{print_day.day: >2}"
|
||||||
if print_day == today:
|
if print_day == today:
|
||||||
output += "</span>"
|
output += "</span>"
|
||||||
print_day += datetime.timedelta(days=1)
|
print_day += datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
output += f'\n<span size="small">{timezone_str}</span>'
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +91,7 @@ def main():
|
|||||||
|
|
||||||
now = datetime.datetime.now(tz=tz)
|
now = datetime.datetime.now(tz=tz)
|
||||||
text = now.strftime("%Y-%m-%d %H:%M")
|
text = now.strftime("%Y-%m-%d %H:%M")
|
||||||
tooltip = make_calendar(now.date())
|
tooltip = make_calendar(now.date(), tz)
|
||||||
|
|
||||||
out = Update(
|
out = Update(
|
||||||
text=text,
|
text=text,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user