Skip to content

Instantly share code, notes, and snippets.

@asl97
Created May 10, 2017 07:27
Show Gist options
  • Save asl97/64b3417312b5b15bc614e95e683b4f96 to your computer and use it in GitHub Desktop.
Save asl97/64b3417312b5b15bc614e95e683b4f96 to your computer and use it in GitHub Desktop.
Read orage globaltime config and output times, useful for conky or i3bar kind of stuff.
import os
import pytz
import datetime
import configparser
config = configparser.ConfigParser()
config.read(os.path.expanduser("~")+"/.config/globaltime/globaltimerc")
now = datetime.datetime.now(pytz.UTC)
o = []
for s in config.sections()[1:]: # ignore first section which should be the default values
c = dict(config.items(s))
c["datetime"] = now.astimezone(pytz.timezone(c["tz"])).strftime("%H:%M")
o.append("{name}: {datetime}".format_map(c))
print(" | ".join(o))
@asl97
Copy link
Author

asl97 commented May 12, 2017

Performance is too slow as a standalone, decided to embed it instead: https://github.com/asl97/asl97-i3bar-status-spacer

Edit: Embed it as in turn it into an script for i3bar to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment