[yambar] Clean clock.py

This commit is contained in:
Midgard 2022-08-29 23:56:05 +02:00
parent ec32ec0bb6
commit e4396a85d6
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4
2 changed files with 8 additions and 11 deletions

View file

@ -6,9 +6,6 @@ import time
import pytz
FILL_CLOCK_FACE = False
# if len(sys.argv) < 3:
# print("Usage: {scriptname} timezone_left timezone_right".format(scriptname=sys.argv[0]), file=sys.stderr)
# exit(1)
@ -24,10 +21,10 @@ FILL_CLOCK_FACE = False
hourhands = ""
minutehands = ""
def face_for(t):
def hands_for(t):
minute = minutehands[ t.minute // 5 ]
hour = hourhands [ t.hour % 12 ]
return hour + minute + ""
return hour + minute
def time_of_day(t):
@ -50,7 +47,7 @@ while True:
# rightnow = utcnow.astimezone(tzright)
print(f"""time_of_day|string|{time_of_day(localnow)}
face|string|{face_for(localnow)}
hands|string|{hands_for(localnow)}
hour|string|{localnow.strftime("%H")}
minute|string|{localnow.strftime("%M")}
weekday|string|{localnow.strftime("%A")}

View file

@ -2,7 +2,7 @@ col_fg: &col_fg "dfdfdfff"
col_fg_alt: &col_fg_alt "777777ff"
col_fg_caution: &col_fg_caution "bd2c40ff"
col_fg_alert: &col_fg_alert "ff4e4eff"
col_meter_bg: &col_meter_bg "444444ff"
col_meter_bg: &col_meter_bg "333333aa"
col_chg: &col_chg "dddd77ff"
font_default: &font_default "Fira Sans:size=12"
@ -150,6 +150,7 @@ bar:
tag: time_of_day
default:
list:
spacing: 0
foreground: "ff0000ff"
items: &clock_contents
- string:
@ -158,10 +159,9 @@ bar:
- string:
text: "{hour} "
font: Fira Sans:size=14
- string:
text: "{face}\uecfd"
font: *font_supplements_20
#foreground: "{color}"
- string: {text: "{hands}\uecfd", font: *font_supplements_20}
- string:
text: " {minute}"
font: Fira Sans:size=14