Skip to main content

Send notification once long running command is finished. Add duration PROMP_FIELD.

Project description

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}}🖥{}}'
$XONRTIB_CD_LONG_DURATION = 5  # default
xontrib load cmd_done

If the command is taking more than $XONRTIB_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 $XONRTIB_CD_TRIGGER_NOTIFICATION = False to completely off the notification part.

Credits

This package was created with xontrib cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-cmd-durations-0.2.7.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

xontrib_cmd_durations-0.2.7-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-cmd-durations-0.2.7.tar.gz.

File metadata

  • Download URL: xontrib-cmd-durations-0.2.7.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Darwin/21.1.0

File hashes

Hashes for xontrib-cmd-durations-0.2.7.tar.gz
Algorithm Hash digest
SHA256 1b27409f5a8db678c68ce9f7d812316192ee6d23b5838e018be74b7b19eac042
MD5 08a11046c140b558c8ab20e7d4199a6c
BLAKE2b-256 966885c304d37cd7e28f921e57019b861926340ba5d3eb6820a30aa08433e25a

See more details on using hashes here.

File details

Details for the file xontrib_cmd_durations-0.2.7-py3-none-any.whl.

File metadata

File hashes

Hashes for xontrib_cmd_durations-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4f03231bcb192f2380972c57b6d51e9b9f54baaa6b22f2c54feda963f68a173a
MD5 02a4b2c0b8ed91932c7d9ad5be862cdd
BLAKE2b-256 81f8a2174cafc202850e86a9023b335c92503013fe25ac19f9b009aa68306f3b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page