Archive Notice
This repo is no longer needed since this extension is now merged into the upstream Python plugin repo.
Extension for converting units of length, mass, speed, temperature, time, current, luminosity, printing measurements, molecular substance, currency, and more in Albert launcher
- Locate the
plugins
directory in the Python extension data directory.
The data directories reside in the data directories of the application defined by Qt. Hence on Linux the modules would be looked up in the following directories (in this order):
~/.local/share/albert/python/plugins
/usr/local/share/albert/python/plugins
/usr/share/albert/python/plugins
- Clone this repository into your
plugins
directory.
cd /path/to/plugins # see above for the path
git clone https://github.com/DenverCoder1/unit-converter-albert-ext.git
- Ensure that
pint
andinflect
are installed in~/.local/share/albert/python/site-packages
.
cd unit-converter-albert-ext
pip install -U -r requirements.txt -t ~/.local/share/albert/python/site-packages
- Enable the extension in the settings under the
Plugins
tab.
Type the trigger, followed by the amount and unit, the word "to" or "in", and then the unit you want to convert to.
<trigger> <amount> <from_unit> {to|in} <to_unit>
Examples:
convert 180 minutes to hrs
convert 100 km to miles
convert 88 mph to kph
convert 32 degrees F to C
convert 3.14159 rad to degrees
convert 100 EUR to USD
To configure the trigger to be something other than "convert ", open the Triggers
tab in the Albert settings.
In config.jsonc
there are options to customize the behavior of the extension:
The rounding_precision
option controls how many decimal places the result will be rounded to. By default, this is 3.
The rounding_precision_zero
option controls how many decimal places the result will be rounded to when the result is close to zero. By default, this is 12.
To add an alias for a unit, add a key-value pair to the aliases
object.
Example: "sec": "second"
allows you to type sec
instead of second
.
Many aliases are already supported.
If the display name of a unit seems strange, you can override it by adding a key-value pair to the display_names
object.
Example: "degree_Celsiuses": "°C"
will make the displayed result appear as 32 °C
instead of 32 degree_Celsiuses
.
If you have any questions, suggestions, or issues, please feel free to open an issue or pull request.
💙 If you like this project, give it a ⭐ and share it with friends!