Overview
Send notification once long-running command is finished and also show the execution time.
Installation
To install use pip:
xpip install xontrib-cmd-durations
# or: xpip install -U git+https://github.com/jnoortheen/xontrib-cmd-durations
Usage
Add the long_cmd_duration section to the prompt fields and load the xontrib i.e.:
$RIGHT_PROMPT = '{long_cmd_duration:⌛{}}{user:{{BOLD_RED}}🤖{}}{hostname:{{BOLD_#FA8072}}🖥{}}'
$XONTRIB_CD_LONG_DURATION = 5 # default
xontrib load cmd_done
If the command is taking more than $XONTRIB_CD_LONG_DURATION seconds then long_cmd_duration returns the duration in human readable way:
The desktop notification is sent if the terminal is not focused:
Currently the focusing part requires xdotool to be installed.
Known issues
Notifications in Windows
On windows the notification will get triggered all the time.
Finding whether the terminal is focused is not implemented for Windows yet and PRs are very welcome on that.
Set $XONTRIB_CD_TRIGGER_NOTIFICATION = False to completely off the notification part.
Notifications in MacOS
If you want to change the app name in notification in MacOS you can use $XONTRIB_CD_NOTIFICATION_APP_NAME environment variable with automatically replaced keywords:
$XONTRIB_CD_NOTIFICATION_APP_NAME = '{user}@{hostname}:{cwd}'
$RIGHT_PROMPT = '{long_cmd_duration}'
xontrib load cmd_done
sleep 6
# Switch to another window
Result:
Credits
This package was created with xontrib cookiecutter template.
Metadata
Release files for xontrib-cmd-durations 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xontrib-cmd-durations-0.3.2.tar.gz | 4.2 kB | Without provenance | Details for xontrib-cmd-durations-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xontrib_cmd_durations-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for xontrib_cmd_durations-0.3.2-py3-none-any.whl |
Total release size: 9.1 kB
Release files / xontrib-cmd-durations-0.3.2.tar.gz
| Download URL | xontrib-cmd-durations-0.3.2.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e5ed13d80c964b1a84694c72234ac9dd3553cb5f45ab4960fba5323374a7abf
|
|
BLAKE2b-256 checksum How to use checksums |
6f038dd10c0331755a6160583b2dd3539b1321a16f57c09b0011f764432a6e05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / xontrib_cmd_durations-0.3.2-py3-none-any.whl
| Download URL | xontrib_cmd_durations-0.3.2-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9e1b16c3e3b00ff9fd4fefa1699941fb33a4e90241c8b7632f4eda54068d66f
|
|
BLAKE2b-256 checksum How to use checksums |
a144ef6c92aff7fee0ce7a70145fd7d2ea315c7d0feeb12c0e37bac3fdd6cb22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for xontrib-cmd-durations 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.