Ultz is a Ulauncher's extension for quick and easy and fast timezone conversion.
The default launch keyword of ultz is tz
.
The query can take 3 different forms:
tz timezone
: Query the current time attimezone
.tz datetime in timezone
: Query the time intimezone
, atdatetime
heretz timezone at datetime
: Query the time here, atdatetime
intimezone
The datetime must be one of the following format:
- (DATE:)
[yyyy-]mm-dd
. For example:1998-11-29
for the 29th of November 1998, right now.05-11
for the 11th of May of this year, right now.
- (TIME:)
HH[:MM[:SS]]
. For example:12:03:54
for this day, at 12h03m54s. DATE TIME
. For example09-03 13:23
There is also an option in the menu which change the DATE format to the alternative: dd-mm-[yyyy]
.
The timezone must either be one of the official timezone from the tz database, or a shorthand. The shorthand are defined in the tz-shorthands file, and was generated so that the last part of the official timezone is enough. For example, Paris
is a shorthand for Europe/Paris
.
A full example would be tz Tokyo at 15:30
, which will returns the time here, at 15:30 in Tokyo.
You can of course change the timezone shorthand, but also add a line to tz-shorthands for custom shortcuts.
The format is dead-simple: each line is a shorthand, the shorthand name must be put first in ALL_CAPS, add a comma ,
, and the target timezone just after.
This file was created by:
- First getting the last part of the
/
-separated timezone - Cleaning by:
- Removing ambiguities (
Australia/West
,Brazil/East
,Brazil/West
) - Removing duplicates (the shorter one, if applicable, is conserved, otherwise alphabetically)
- Removing ambiguities (
- Adding
PST
andPDT
As Ulauncher doesn't support arbitrary package requirements, the tz database backend, pytz, is included in the repo at a fixed version. If the tz database changes, for example if a country adds or removes light-saving times, this extension must be updated. Please open an issue if it's the case!
I wanted to learn more about Python, so I deliberately over-engineered the framework around this simple project with:
- Formatter: Black and isort
- Linters: Pylint and bandit
- Better code: MyPy (type checking) and unit tests with mocking
- Documentation: Sphinx
I also wanted to add some continuous integration with Github but dropped the case after seeing it would need even more configuration.
- ultz: GPLv3
- pytz: MIT
- icon: Yaru icon theme (Attribution-ShareAlike 4.0 International (CC BY-SA 4.0))