[polybar] Getting tired of the timezones

This commit is contained in:
M1dgard 2018-08-06 20:20:20 +02:00
parent 5b71427ac5
commit 15c095dd69
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4
2 changed files with 17 additions and 16 deletions

View file

@ -7,16 +7,16 @@ import pytz
try: try:
if len(sys.argv) < 3: # if len(sys.argv) < 3:
print("Usage: {scriptname} timezone_left timezone_right".format(scriptname=sys.argv[0]), file=sys.stderr) # print("Usage: {scriptname} timezone_left timezone_right".format(scriptname=sys.argv[0]), file=sys.stderr)
exit(1) # exit(1)
try: # try:
tzleft = pytz.timezone(sys.argv[1]) # tzleft = pytz.timezone(sys.argv[1])
tzright = pytz.timezone(sys.argv[2]) # tzright = pytz.timezone(sys.argv[2])
except pytz.exceptions.UnknownTimeZoneError as e: # except pytz.exceptions.UnknownTimeZoneError as e:
print('Unknown time zone "{}"'.format(e.args[0]), file=sys.stderr) # print('Unknown time zone "{}"'.format(e.args[0]), file=sys.stderr)
exit(1) # exit(1)
hourhands = "" hourhands = ""
@ -45,8 +45,8 @@ try:
while True: while True:
utcnow = datetime.now(tz=pytz.utc) utcnow = datetime.now(tz=pytz.utc)
localnow = datetime.now() localnow = datetime.now()
leftnow = utcnow.astimezone(tzleft ) # leftnow = utcnow.astimezone(tzleft )
rightnow = utcnow.astimezone(tzright) # rightnow = utcnow.astimezone(tzright)
localcolor = color_for(localnow) localcolor = color_for(localnow)
@ -54,14 +54,14 @@ try:
localnow.strftime("%A") + localnow.strftime("%A") +
" " + " " +
face_for(leftnow) + # face_for(leftnow) +
" %{T4}" + localcolor + localnow.strftime("%H") + " %{T4}" + localcolor + localnow.strftime("%H") +
"%{O2}%{T8}" + face_for(localnow) + "%{O2}%{T8}" + face_for(localnow) +
"%{O2}%{T4}" + localcolor + localnow.strftime("%M") + "%{T-}" + "%{O2}%{T4}" + localcolor + localnow.strftime("%M") + "%{T-}" +
" " + " " +
face_for(rightnow) + # face_for(rightnow) + " " +
" " + " " +
localnow.strftime("%d %b"), localnow.strftime("%d %b"),

View file

@ -338,7 +338,8 @@ label-connected = "%{O-32}"
type = custom/script type = custom/script
tail = true tail = true
exec = ~/.config/polybar/clock.py America/Detroit Asia/Seoul exec = ~/.config/polybar/clock.py
;America/Detroit Asia/Seoul
[module/volume] [module/volume]
type = internal/pulseaudio type = internal/pulseaudio