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

View file

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